Created
July 4, 2017 23:26
-
-
Save EricWF/f3540556d8ff08efe73edfb271c37bfb to your computer and use it in GitHub Desktop.
This file contains 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
class A { | |
class DecodingState; | |
class B; | |
}; | |
template <class> struct ReturnTypeHelperImp; | |
template <class S, class R> struct ReturnTypeHelperImp<R(S::*)()> { | |
using type = R; | |
}; | |
template <class T> using ReturnTypeHelper = typename ReturnTypeHelperImp<T>::type; | |
class A::DecodingState { | |
void Enter(); | |
protected: | |
template <class S> ReturnTypeHelper<decltype(&S::Enter)> SetState(); | |
}; | |
class A::B : DecodingState { | |
void Step(); | |
}; | |
void A::B::Step() { SetState<DecodingState>(); } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment