In C++0x, is it legal / expected that some classes can be copied but not moved? I’m looking at implementing a heterogenous class that resizes, and I’m not sure I could handle it if some classes needed copying and some needed moving.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, it’s legal for a class to be copyable but not movable:
However, I can’t think of a good reason as to why anyone would want to do this. Knowing C++ coders (like me!) though, I think that you should anticipate that this might come up.
Out of curiosity, what code are you relying on that would break if a class was copyable but not movable?