sunshilong369
sunshilong369

Reputation: 756

Could a object be moved if this is no `copy constructor` for the class?

Could a object be moved if this is no copy constructor for the class?In another word, is it legal that a class has move constructor whereas its copy constructor is marked as deleted.If it's ok, does it go againt the rule of three, rule of five?

Upvotes: 2

Views: 248

Answers (1)

Some programmer dude
Some programmer dude

Reputation: 409482

Yes it's perfectly legal.

Think about e.g. std::unique_ptr, which is indeed movable but not copyable.

Upvotes: 7

Related Questions