Consider the following simple example
struct Banana{
};
struct Apple{
};
struct Watermelon{
};
template<typename Fruit>
struct Stand {
protected:
Fruit& get();
private:
Fruit fruit_;
};
template<typename... Stands>
struct TownFairStands : private Stands... {
template<typename Fruit>
Fruit& get() {
return Stand<Fruit>::get();
}
};
int main(){
TownFairStand<Banana, Apple, Watermelon> stand;
TownFairStands<Stand<Banana>, Stand<Apple>, Stand<Watermelon>> stand2;
return 0;
}
The ugly way of defining a TownFairStand is the one defined with stands2. But I would like the option of the cleaner interface defined with stand.
However I am stuck on trying to figure out how I can create this interface
template<typename... Fruits>
struct TownFairStand : private ??????{
template<typename Fruit>
Fruit& get(){
return Stand<Fruit>::get();
}
};
What goes in place of ?????
Stand<Fruits>...