Is there any class similar to http://www.boost.org/doc/libs/1_53_0/boost/noncopyable.hpp introduced by C++ 11? I can't use = delete
feature as my compiler doesn't support it. I would prefer to use standard library features if possible instead of boost or implementing my own.
A class called non-copyable is defined which has a private copy constructor and copy assignment operator.
Boost::noncopyable prevents the classes methods from accidentally using the private copy constructor.
One can make a class uncopyable, i.e., move-only, by using deleted definitions of the copy constructor and copy assignment operator, and then providing defaulted definitions of the move constructor and move assignment operator. A deleted function is implicitly an inline function ([dcl. inline]).
No, there is no similar standard class. C++11 introduced = delete
for this purpose, so additionally introducing a class would have been needlessly redundant and useless.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With