Honest question: what do you expect the answer to be? Pedantically, the "correct" answer is that it statically casts its argument to an xvalue. Is this a way to tell if the candidate understands value categories?
I think it would be more elucidating to consider the myriad common incorrect answers you expect to get when asking that question--which is what I expect they are dealing with, given the more about how rare even having "a good guess is"--as opposed to whether they are expecting a single particularly-correct answer.
Anything that’s not that is generally incorrect in some way, though. std::move doesn’t move, or take ownership. People use it anyways. The same applies to constructs like std::forward, or the dozen ways to do initialization. C++ has a standard that incomprehensible to most people because it bends over backwards to try to come up with a unified set of rules for disparate behavior. Unless you’re a library author knowing these things off the top of your head doesn’t show much about your ability to understand some sort of understanding of the how C++ works, because there is no consistent understanding to be made. It might make sense to ask how std::move might work in Rust but it’s basically trivia for C++.
Yeah, but like, the egregiously wrong answers you are likely to get that aren't even close--not to the underlying behavior but even to the way it is commonly used--are apparently so wrong you don't even list them in your list of wrong answers ;P.
Someone who doesn't know how it works but successfully have ever written a move constructor (which is a bit more advanced than merely using one) are going to come up with an answer that I would personally (as not the person who said this... for all I know they also will be super pedantic) claim is "close".
But, I would fully expect the majority of people you ask that question to will, for example, actually claim stuff like that the prior value is completely destroyed... not even merely deconstructed (which is already problematic), but somehow deallocated even if located on the stack, which is way more wrong than merely thinking std::move "takes ownership".
I don't know if you play chess at all, but a book I really enjoyed (and read probably about when I was your age? and the existence of which--honestly more than the specific content--massively informed my teaching style) was The Amateur's Mind, which was a chess master going back and attempting to not as much teach chess from his vantage point to an amateur but to go back and explore the misunderstandings amateurs have about chess by way of interviews with amateurs about games and then trying to work within that mental model. I think that, even though we were all amateurs at one point--or even might have a long way to go still--it can be difficult to really conceptualize the gulf between what an amateur thinks and what you might even assume is the mistake they are making.
Honest question: what do you expect the answer to be? Pedantically, the "correct" answer is that it statically casts its argument to an xvalue. Is this a way to tell if the candidate understands value categories?