5

I found this in std::vector::push_back() implementation:

void push_back(_Ty&& _Val)
{
    // some code here       
}

and this in std::map operator[] implementation:

mapped_type& operator[](key_type&& _Keyval)
{
    // some code here   
}

Why _Val and _Keyval is taking by the reference-by-reference? How does the taking of the argument by reference-by-reference working? What are the benefits of this approach in comparison with the taking by reference?

P.S. This is NOT the logical "AND", I understand this clearly.

Netherwire
  • 2,669
  • 3
  • 31
  • 54

1 Answers1

2

This is a C++11 feature - rvalue references... Here's some more info

Tom
  • 2,369
  • 13
  • 21