c++11 - C++: Overloaded template alias -
There is currently a special standard library programming, and I think it is necessary for me in a particular case:
named place std {// key, value template & class; Class K, class V & gt; Vector_map = other_name location :: vector_map and lieutenant; K, V & gt; // key, value, compare template & lt; Class K, Class V, Class C & gt; vector_map = other_namespace :: vector_map & lt; By using V, C & gt; } This works, however, does not work, does not surprise. But what are my options to achieve this? I have thought of using the preprocessor, but I want to know what you think people think.
I want to be able to select aka template category in another name, if possible.
The solution (in my case) was to add a default value instead of several values:
name space std {// key, compare prices, templates; Square k, class V, square c = default_mountain & gt; vector_map = other_namespace :: vector_map & lt; By using V, C & gt; } " Use the to use . template & lt; Class A, Class B, Class ... C & gt; Struct vector_map_helper {type = other_namespace :: vector_map & lt; A, B & gt; }; Expert for // 3: template & lt; Class A, Class B, Class C & gt; Struct vector_map_helper & lt; A, B, C & gt; {Type = other_name location :: vector_map & lt; A, B, C & gt; }; Template & lt; Class A, Class B, Class C, Class D, Class ... Z & gt; struct vector_map_helper & lt; A, B, C, D, Z ... & gt; // Error 4 or more template & lt; Class A, Class B, Class ... C & gt; Using vector_map = typename vector_map_helper & lt; A, B, C ... & gt; :: type; In general, even if you are implementing the std library, you should avoid adding any "user facing" interface to your std . Those that do not come from the std library, and the stuff you support must match the std specifications. The non- std extensions for a std :: ext namespace make both of these existing codes or a nonstd Fails to compile or work, and to avoid training in bad habits about what your programmer-user has in the std . / html>
Comments
Post a Comment