have written this little class, which generates a UUID every time an object of this class is created.
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid_io.hpp>
class myClass {
public:
boost::uuids::uuid GetUUID();
virtual ~myClass();
myClass() { // constructor
mId = boost::uuids::random_generator()();
std::cout<< "object created with uuid " << mId <<std::endl;
}
private:
boost::uuids::uuid mId;
}
At some point, I am pushing these objects to a vector and equating that vector with another vector using simple assignment operator. To ensure the objects in the new vector do not generate new UUIDs, I want to write a copy constructor. But as you can see, the constructor needs no arguments. So I am not sure how to write the copy constructor. Moreover, if I have multiple variables instead of just one UUID, how do I handle that situation?