c++ template policy
template<typename... Policies>
class PolicyAndVaradic: public Policies...
{
public:
template<typename... Args>
PolicyAndVaradic(const Args... Arg)
: Policies(Arg)...{}
};
class PolicyOne
{
std::string mText;
public:
PolicyOne(const char* aText):mText(aText){}
void executePolicyOne()
{
std::cout << mText << std::endl;
}
};
class PolicyTwo
{
std::string mText;
public:
PolicyTwo(const char* aText):mText(aText){}
void executePolicyTwo()
{
std::cout << mText << std::endl;
}
};
PolicyOneAndPolicyTwo linstance("PolicyOne", "PolicyTwo");
linstance.executePolicyOne();
linstance.executePolicyTwo();