mercredi 27 mai 2020

Differences between `typename std::remove_reference

As per the documentation(https://en.cppreference.com/w/cpp/utility/move), there are two kinds of constructors for std::move<T>, which are posted below.

What are the differences between these constructors? What confused me most is that why there needs the keyword(typename) in the second constructor.

I am a novice in C++.I would be thankful for any hint on this question.

template< class T >
typename std::remove_reference<T>::type&& move( T&& t ) noexcept;    (since C++11)     (until C++14)
template< class T >
constexpr typename std::remove_reference<T>::type&& move( T&& t ) noexcept;    (since C++14)

Aucun commentaire:

Enregistrer un commentaire