Why my class cannot be used in STL container?
The STL containers expect the class provides copy assignment operator and copy constructor. When a class does not have them, the code won't compile. The following rules dictate how a compiler generates default copy assignment operator for a class:
The compiler mustn't define an implicit copy assignment operator
if the class has:
-a nonstatic data member of const type, or
-a nonstatic data member of reference type, or
-a nonstatic data member of class type (or array thereof) with
an inaccessible copy assignment operator, or
<< Home