Created
March 12, 2017 10:56
-
-
Save htfy96/271e108955735ab14a3d2245af2cb3fb to your computer and use it in GitHub Desktop.
tag example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Class1 | |
{ | |
using Tag = Tag1; | |
}; | |
struct Class1B | |
{ | |
using Tag = Tag1; | |
}; | |
struct Class2 | |
{ | |
using Tag = Tag2; | |
}; | |
template<typename T> | |
void f(T obj) | |
{ | |
f_impl(T::Tag, obj); | |
} | |
template<typename T> | |
void f_impl(Tag1, T obj) | |
{ | |
} | |
template<typename T> | |
void f_impl(Tag2, T obj) | |
{ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment