struct custom
{
custom();
custom(const custom &);
custom(custom &&);
};
custom find()
{
return custom();
}
void take(const custom &c)
{
custom temp = t;
}
void take(custom &&c)
{
custom temp = std::move(c);
}
How many calls to the constructors of custom
are made and in what order by the following:
custom first = find();
take(first);
custom second = find();
take(std::move(second));
The first find()
call just uses the default constructor. The first take
call uses the copy constructor I believe. Second find()
call also just uses the default constructor. I am not certain of the second take
call. I believe it uses the move constructor here. Is that correct? If so, the sequence of constructor calls is default, copy, default, move (in this order)?