I'm trying to declare a lot of templatized Derived<T> objects that inherit from Base, and pushing them back in a std::vector<Base*>.
struct Base { ... };
template<typename T> struct Derived : Base { /* ctor(const string&) */ ... }
Derived<bool> online{"online"};
Derived<bool> official{"official"};
Derived<bool> noRotation{"no_rotation"};
Derived<bool> noBackground{"no_background"};
Derived<int> noSound{"no_sound"};
Derived<string> noMusic{"no_music"};
Derived<bool> blackAndWhite{"black_and_white"};
vector<Base*> configValues{&online, 
                           &official, 
                           &noRotation, 
                           &noBackground, 
                           &noSound, 
                           &noMusic, 
                           &blackAndWhite};
As you can see, the code is horrible. Is there any way to automate this without passing the vector as a const& in the Derived<T>::Derived<T>(...) constructor?
By automate I mean avoiding the repetition of the objects' names. I would like to fill a std::vector with all my Derived<T> objects without having to list them all manually.
(Macros accepted, but hopefully there's a better solution)
 
     
     
     
    