Hi everyone i'll keep it brief.Say i have
template <int k> struct A {
enum {key=k};
};
template <int t> struct B {
std::vector <A<y>* > vec;
B () {
vec.push_back (new A<y> ());
B <t-1> ();
}
};
template <> struct B <0> {};
int main () {
B <10> b;
}
Now this works .. unless i define arguments for the B's constructor.I must create an array of objects each of which should contain a unique static integral member.
This works too:
template <int t> struct B {
std::vector <A<y>* > vec;
int y;
B (int x) : y(x) {
B <t> ();
}
B () {
vec.push_back (new A<y> ());
B <t-1> ();
}
};
But how should this be writeen ?
template <int t> struct B {
int y;
std::vector <A<y>* > vec;
B (/* int x */) : x(y) {
vec.push_back (new A<y> ());
B <t-1> (/* what here? */);
}
};