Learning C++ initialization on cppreference I found the following (as value initialization "since C++11"):
1) if T is a class type with no default constructor or with a user-provided or deleted default constructor, the object is default-initialized;
2) if T is a class type with a default constructor that is neither user-provided nor deleted (that is, it may be a class with an implicitly-defined or defaulted default constructor), the object is zero-initialized and then it is default-initialized if it has a non-trivial default constructor;
...
This means that a class type can have:
- no;
- user provided;
- deleted;
- implicitly-defined;
- defaulted;
default constructor.
What does "no" default constructor mean? Don't class types always have one at least implicitly defined (or it is deleted)?
Aucun commentaire:
Enregistrer un commentaire