Question.3
A developer writes the following code:
Buffer b1(64); Buffer b2 = std::move(b1);
If the Buffer class has no move constructor (only a copy constructor), what happens?
Buffer
Select Answer
Compilation error -- std::move requires a move constructor
std::move
b1 is moved anyway -- std::move forces the transfer
b1
The compiler silently falls back to the copy constructor -- b2 is a deep copy of b1, with full allocation + memcpy cost
b2
memcpy
Undefined behavior