What do we call a constructor of type C :: C (const C &&)? And is there any use for this other than the ban on moving from const?

I can have a declaration of three type constructors

  • copy constructor C::C(const C&)
  • move constructor C::C(C&&)
  • C::C(const C&&)

in a class without ambiguity.

What do we call a type constructor C::C(const C&&)? Does he have some kind of nickname?

I can come up with =deleteto explicitly prohibit users from unknowingly trying to navigate with constand limit the effect of automatic backups. This reminds users what they are doing.

And is there any other use for it?

+4
source share
1 answer
C::C(C const&&);

is what I call the const constructor.

, (A) , (B) ( const, - undefined).

, C mutable, - . , , a const&, C const&&.

=delete . .

+6

Source: https://habr.com/ru/post/1686829/


All Articles