In STL, I saw the following template definitions:
template <class _Ty>
struct remove_reference {
using type = _Ty;
using _Const_thru_ref_type = const _Ty;
};
template <class _Ty>
struct remove_reference<_Ty&> {
using type = _Ty;
using _Const_thru_ref_type = const _Ty&;
};
I have not seen struct remove_reference<_Ty&>
this kind of syntax before at the definition of a struct. The syntax similar to this that I know is that when you create a new object e.g. remove_reference<_Ty&> newObject
.
What does it mean to use struct remove_reference<_Ty&>
at the definition of a struct?
This is not like a template specialization either, as it will resemble the format like template<> struct remove_reference<_Ty&>
. Could anyone let me know what c++ feature this is, and the official link, please?
Please note: this is not a duplicate of the common specification questions. As they didn't discuss the syntax of keeping both the generic template parameter on the top and in the struct at the same time.