class MyRefType {
private:
MyRefType & operator=(const MyRefType &);
MyRefType(const MyRefType &);
public:
MyRefType () {}
};
class my_class {
unique_ptr<BigHugeData> data;
public:
my_class( my_class&& other ) // move construction
: data( move( other.data ) ) { }
my_class& operator=( my_class&& other ) // move assignment
{
data = move( other.data );
return *this;
}
// ...
void method() { // check (if appropriate)
if ( !data )
throw std::runtime_error("RUNTIME ERROR: Insufficient resources!");
}
};
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
my_class Data1;
my_class Data2;
Data1 = Data2;
Serial.print("Data 1:=");
Serial.println(Data1);
Serial.print("Data 2:=");
Serial.println(Data2);
}
void loop() {
// put your main code here, to run repeatedly:
}