templates - Extract the generic type of another generic type in C++ -


I have a square fu which uses two different common types, a _Type And other _Comparator is _Type to std :: vector , std :: list , or std :: string is known as , so it will be of one type within it: T within vector and list ; Within the Four string .

My other common type is _Comparator , which is an optional template parameter, by which it specifies its lesser than the user function, factor, or lambda function. If no argument is provided in the form of a second argument parameter then it should be std :: less ; M & gt; functor, by which the type of elements contained in the type M should be _Type .

How to do this I do not have this syntax.

I have tried:

  template & lt; Typename _Type & lt; T & gt;, typename _Comparator = less & lt; T & gt; & Gt;   

@Jakim Pielborg In the comment, I Came along, who gave me the _Type :

  template   

And now std :: less compares the right type without complaining.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -