Is there a std::noncopyable (or equivalent)?

No, because there is a standard way to make a class non-copyable:

class MyClass
{
   MyClass(const MyClass&) = delete;
   MyClass& operator=(const MyClass&) = delete;
}:

A class that is non-copyable can however be made movable by overloading a constructor from MyClass&&.

The declaration to make the class non-copyable (above) can be in the public or private section.

If you don’t really want to type all that out every time, you can always define a macro something like:

#define NONCOPYABLE(Type) Type(const Type&)=delete; Type& operator=(const Type&)=delete

class MyClass
{
    NONCOPYABLE(MyClass);

    // etc.
};



  

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)