这两行奇怪的代码是什么意思?
thread_guard(thread_guard const&) = delete; thread_guard& operator=(thread_guard const&) = delete;
解决方法
@H_404_7@ = delete是C 0x的新功能.这意味着一旦用户使用这样的函数,编译器应立即停止编译并抱怨“此函数被删除”(参见:Bjarne Stroustrup的C 0x FAQ的 defaulted and deleted functions — control of defaults).thread_guard(thread_guard const&)是一个复制构造函数,thread_guard& operator =(thread_guard const&)是赋值构造函数.因此,这两行一起禁用了thread_guard实例的复制.