0

Why does C++ allow constant rvalue references ? I just noticed that this will be actually used by

std::pair<T1, T2>::pair::pair( const pair<U1, U2> &&p )
Bonita Montero
  • 2,817
  • 9
  • 22
  • It allows you to move const-qualified variables. Usually you won't be able to implement move semantics of a const object, but there may be some scenarios where the resources are held inside a mutable member variable. Why make this inconsistent with normal references, if there may be a use case for this, even if it's a rare one? – fabian Feb 12 '22 at 10:10
  • does this post answer the question? https://stackoverflow.com/questions/4938875/do-rvalue-references-to-const-have-any-use – JanPo Feb 12 '22 at 11:14

0 Answers0