Reputation: 10539
Under MSVC2010 the definition of move constructor for vector
class is the following :
vector(_Myt&& _Right)
: _Mybase(_Right._Alval)
{ // construct by moving _Right
_Assign_rv(_STD forward<_Myt>(_Right));
}
As there is also a definition of a copy constructor, I guess we never call vector(_Myt&& _Right)
with a lvalue reference as argument.
So I'm wondering if here, this line :
_Assign_rv(_STD forward<_Myt>(_Right));
could be replace by :
_Assign_rv(_STD move<_Myt>(_Right));
with no side effect
Upvotes: 3
Views: 685
Reputation: 234474
Yes, for a type without reference qualifiers T
, both std::forward<T>
and std::forward<T&&>
are just fancy ways of saying std::move
.
Upvotes: 4