Default move constructor/assignment and deleted copy constructor/assignment

user-declared means either user-provided (defined by the user), explicitly defaulted (= default) or explicitly deleted (= delete) in contrast with implicitly defaulted / deleted (such as your move constructor). So in your case, yes the move constructor is implicitly deleted because the copy-constructor is explicitly deleted (and thus user-declared). However, in that particular case, how … Read more

Deletion of copy-ctor & copy-assignment – public, private or protected?

what is the right place to do it – in the public, private or protected section of the class? I would put them in the public section. This is because deleting a constructor or an assignment operator is orthogonal to making them private / protected; and when these aren’t deleted, they are public by default. … Read more

Can one delete a function returning an incomplete type in C++?

Clang is wrong. [dcl.fct.def.general] 2 The type of a parameter or the return type for a function definition shall not be a (possibly cv-qualified) class type that is incomplete or abstract within the function body unless the function is deleted ([dcl.fct.def.delete]). That’s pretty clear I think. A deleted definition allows for an incomplete class type. … Read more

error: use of deleted function

The error message clearly says that the default constructor has been deleted implicitly. It even says why: the class contains a non-static, const variable, which would not be initialized by the default ctor. class X { const int x; }; Since X::x is const, it must be initialized — but a default ctor wouldn’t normally … Read more

How is “=default” different from “{}” for default constructor and destructor?

This is a completely different question when asking about constructors than destructors. If your destructor is virtual, then the difference is negligible, as Howard pointed out. However, if your destructor was non-virtual, it’s a completely different story. The same is true of constructors. Using = default syntax for special member functions (default constructor, copy/move constructors/assignment, … Read more

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