Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // .h
- enum class EnumFoo {A, B, C}; // EnumClass
- enum class EnumTest {D, E, F}; // BtsStruct
- class MyStruct {};
- template <EnumFoo enumFoo>
- struct MyTraits
- {
- typedef int Other;
- static const EnumTest MY_STATIC_CONST_VALUE;
- static int foo(const MyStruct& myStruct)
- {
- return 0;
- }
- };
- // .cpp
- template <EnumFoo type>
- const EnumTest MyTraits<type>::MY_STATIC_CONST_VALUE = EnumTest::D;
- // client h
- template <EnumTest test>
- void g(test t)
- {
- h(t);
- }
- // main.cpp
- g<MyTraits<EnumFoo::A>::MY_STATIC_CONST_VALUE>();
- template <EnumFoo enumFoo>
- struct MyTraits
- {
- typedef int Other;
- static const EnumTest MY_STATIC_CONST_VALUE = EnumTest::D;
- static int foo(const MyStruct& myStruct)
- {
- return 0;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement