3 ms·
I like that each question has a purpose. It's an interesting problem to determine a (small) set of questions that "cover" the (large) space of C++ knowledge in
by edflsafoiewq 8y ago
I like that each question has a purpose. It's an interesting problem to determine a (small) set of questions that "cover" the (large) space of C++ knowledge in the sense that if someone can answer them all, they likely have a strong knowledge of the language.
> The interview candidate might think that returning a noncopiable object from a function is also a compiler error, but in this case it’s allowed, thanks to copy elision. You can ask the candidate under what conditions copy elision is performed.
This isn't copy elision. Copy elision isn't even permitted here because the returned expression is the name of a function parameter. The two-stage overload resolution that tries a move constructor first is defined in the same section of the spec, [class.copy.elision], as copy elision but the rules are different and it is always performed, even if the implementation doesn't do copy elision.