noncopyable.h

来自「C++ patterns设计模式」· C头文件 代码 · 共 39 行

H
39
字号
////////////////////////////////////////////////////////////////////////////////
// Author      : 黎达文                                                        
// Description : 定义一个基类表示不可以复制的概念。
//               当一个类需要这些概念的时候只要继承它就可以了。
//
// Version     : 
//
// Standard include files : 
//
// Start Date  : 2003年6月20日
//
// Change Log  : 
// 2003年6月20日 by 黎达文
// -- Created
////////////////////////////////////////////////////////////////////////////////
#ifndef INCLUDED_NONCOPYABLE_H
#define INCLUDED_NONCOPYABLE_H

#if defined(HAS_PRAGMA_ONCE)
#pragma PRAGMA_ONCE_DECLARE
#endif

namespace stk
{
    //  Private copy constructor and copy assignment ensure classes derived from
    //  class noncopyable cannot be copied.
    class noncopyable
    {
    protected:
        noncopyable() {}
        ~noncopyable() {}
    private:  // emphasize the following members are private
        noncopyable( const noncopyable& );
        const noncopyable& operator=( const noncopyable& );
    };
}

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?