Boost logo

Boost Users :

From: bringiton bringiton (kneeride_at_[hidden])
Date: 2006-07-27 21:17:36


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.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net