Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DataStruct()
- : m_data(new InternalData())
- , m_index(++s_index)
- {
- std::cout << "Owner Constructor: " << this << ", " << s_index << "\n";
- }
- ~DataStruct()
- {
- std::cout << "Owner Destructor: " << this << ", " << s_index << "\n";
- }
- DataStruct(DataStruct& other) //copy
- {
- std::cout << "Owner Copy Constructor: " << this << ", " << s_index << "\n";
- swap(*this, other);
- }
- friend void swap(DataStruct& first, DataStruct& second)
- {
- std::cout << "Owner Swapping: " << &first << " and " << &second << "\n";
- using std::swap;
- swap(first.m_data, second.m_data);
- }
- DataStruct& operator=(DataStruct copy) //assignment
- {
- std::cout << "Owner Assingment operator: " << this << ", " << s_index << "\n";
- swap(*this, copy);
- return *this;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement