Possible Duplicate:
Where and why do I have to put the “template” and “typename” keywords?
I'm reading this so I'm now looking at the implementation of std::forward
and std::move
:
// TEMPLATE FUNCTION forward
template<class _Ty> inline
_Ty&& forward(typename identity<_Ty>::type& _Arg)
{ // forward _Arg, given explicitly specified type parameter
return ((_Ty&&)_Arg);
}
// TEMPLATE FUNCTION move
template<class _Ty> inline
typename tr1::_Remove_reference<_Ty>::_Type&&
move(_Ty&& _Arg)
{ // forward _Arg as movable
return ((typename tr1::_Remove_reference<_Ty>::_Type&&)_Arg);
}
I think I get the whole story but I don't understand the use of the typename
outside of the template definition (template<...>
). What does it mean in this case?