Better yet, for the majority of cases, just inherit from an uncopyable class like boost::noncopyable.
Better yet, for the majority of cases, just inherit from an uncopyable class like boost::noncopyable.
'= delete' makes it exceedingly clear that what they are doing is not allowed, rather than "oh god dammit cmake what did I miss now..."
Since '= deleted' was added in C++11, there's really not any good "backwards-incompatible" arguments to be made about avoiding it. C++11 support is extremely broad at this point and has been for many, many years now.
I think you missed the importance of private. Users of it won't get it to compile for them to get a linker error.
if the only reason for using the C++11 standard were the =delete syntax, by all means, just use boost::noncopyable. But if you are using features from C++11, then there is really no reason for not using the new syntax.
A deleted copy constructor produces better error messages. And it's not really backwards-incompatible at this point--deleted functions exist in compiler versions old enough to get a COVID-19 vaccine.
I was wrong. delete leaves it in the overload set. I've been using C++ for a decade and I'm still tripping over some of the stupider semantics.
class C {
public:
C(int) = delete;
C(long) {}
};
int main() {
C x(3);
}