Easy
std::move on a type with no move constructor
What does this program print?
main.cpp
#include <iostream>
#include <string>
struct NoMove {
std::string data;
NoMove(const std::string& s) : data(s) {}
NoMove(const NoMove& other) : data(other.data) { std::cout << "copy\n"; }
// no move constructor declared, and none is implicitly generated
// because a copy constructor is user-declared
};
int main() {
NoMove a("hello");
NoMove b(std::move(a));
std::cout << a.data << std::endl;
}13 of 117 in C++