Last active
July 29, 2021 08:44
-
-
Save yaqwsx/b7f96938a866414f733d4ed135bb876d 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
// Approach used in DIOS | |
class Base {}; | |
template < typename Next > | |
class FatureA: public < Next > {}; | |
template < typename Next > | |
class FeatureB: public < Next > {}; | |
using MyType = FeatureB < FeatureA < FeatureB< Base > >; | |
// Alternative | |
template< template < typename > typename... Features > | |
class Base: public Features< Base < Features... > >... {}; | |
template < typename Self > | |
class FatureA { | |
CRTP_SELF(); | |
// Access other components via self().something | |
}; | |
template < typename Self > | |
class FatureB { | |
CRTP_SELF(); | |
// Access other components via self().something | |
}; | |
using MyType = Base< FeatureA, FeatureB >; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment