Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumC++move semantics and rvalue refsSingle-choice MCQ

Given the move constructor below, what is the size of `a.name` after the move, and why?

struct S { std::string name; S(S&& other) : name(other.name) {} S(std::string n) : name(std::move(n)) {} }; int main() { S a("a very long string well beyond the SSO buffer length here..."); S b(std::move(a)); std::cout << a.name.size(); }