Let's say I have a class Foo that uses two different types, one - _Typeand the other - _Comparator. _Typeknown as std::vector, std::listor std::string, therefore, it will have a type inside it: it Twill be within vectorand list; charwill be within string.
My other generic type _Comparatoris an optional template parameter whereby a user can specify his own function less than a function, functor or lambda. If no argument is specified as the second parameter of the template, it should use a functor by default std::less<M>, in which the type Mmust be the type of the elements contained in _Type.
I do not know the syntax of how to do this.
I tried:
template <typename _Type<T>, typename _Comparator = less<T> >
to no avail.
source
share