c++ - Template parameters not deducible in partial specialization -
I have a similar problem but it may be that I'm still doing something different, so I do not have any Ask me
There are some types that will be tagged with tag structure:
template & lt; Typename geometry = void, enable typename = null & gt; Structure tag {typedef zero type; }; And point and triangle tags are introduced:
struct point_tag {}; Structure triangle_tag {}; :
template to create a point type using std :: vector & Gt; Structure tag & lt; Std :: vector & lt; Double & gt; & Gt; {Typed point_tag type; }; Type of a triangle in the form of the and std :: arrays template: template & lt; Typename point & gt; Triangle = Type name std :: enable_if & lt; Std :: is_base_of & lt; Typename tag & lt; Point & gt; :: type, point_tag & gt; :: value, std :: array & lt; Point, 3 & gt; & Gt; :: type; This argument is enabled if the argument is actually the point_tag as the dot parameter, , I would like to tag all the triangles from triangle_tag in this way: template & lt; Typename point & gt; Strip tag & lt; Triangle & lt; Point & gt; & Gt; {Typed triangular tip type; }; std :: array is given the only place and the composite / inheritance is not found, because creation causes problems with heritage, though compilation error Fails with g ++ -std = c ++ 1y main.cpp -o key main.cpp: 31: 8: error: template parameters can not be reduced in partial expertise Is: strip tag & lt; Triangle & lt; Point & gt; & Gt; ^ Main.cpp: 31: 8: Note: A point ??? If I do not depend on enabling triangles based on the triangle tag, but do it for all types of it: template & lt; Typename point & gt; This works by using triangle = //, but there is no restriction for tagging points with point_tags. Std :: Array & lt; Point, 3 & gt;; So the compile works fine. However, then the triangle is an triangle , and I am using those functions to minimize the function template for which enable_if fails for viable template arguments Functions are not dependent on the container interface for templates because sometimes the built-in interface is exactly the same , but the operation semantics is different For example, the triangle is a closed maturation The line segment (including operations on 3 sides), and a point series is an open-end line segment includes operations (2 sides). All tasks require direct access operators that are the only requirement for template parameters, which, when without implementing the enabled_if restrictions, in the function template leads to ambiguity - all linked Articles include. is here
Am I missing? How to get this problem?
Do not use your enabled template parameters?
Something like this: template & lt; Typename point & gt; Structure tag & lt; Std :: array & lt; Point, 3 & gt;, type name std :: enable_if & lt; Std :: is_base_of & lt; The typename tag & lt; Point & gt; :: type, point_tag & gt; :: Price & gt; :: type & gt; {Typed triangular tip type; }; (OK, you repeat enable_if ...)
Comments
Post a Comment