Files
concurrency-in-action/source/listing_a.1.cpp
2018-10-18 00:40:34 -05:00

14 lines
272 B
C++

class X {
private:
int* data;
public:
X() : data(new int[1000000]) {}
~X() { delete[] data; }
X(const X& other) : data(new int[1000000])
{
std::copy(other.data, other.data + 1000000, data);
}
X(X&& other) : data(other.data) { other.data = nullptr; }
};