I have a specific c++ question, and was wondering whether someone could offer some advice. Is is safe to assume that modern compilers will supply a default copy constructor and default assignment operator that will copy all attributes? Or may I run into undefined behaviour between compilers. class Test: public: int v1; char v2; float v3 std::string v4; std::vector<int> v5; boost::shared_ptr<int> v6; }; ie is it safe to assume that Test's copy constructor will call the copy constructor of all the above attributes. NOTE: i am only talking about attributes that are already copiable. i understand that if a class manages it's own memory, the copy constructor will need to be defined. **Just so we are using the same terminology, does c++ have a pattern to define concrete objects that are copiable? ie your basic types, int, char, float. and classes that have been designed to be copiable: ie std::string, std::vector etc. **Maybe it's called concrete type.
participants (1)
-
bringiton bringiton