Consider the following existing code (which compiles and executes as expected):
/* File foo.h */
extern const struct Foo bar[]; /* Definition in foo.cpp */
struct Foo
{
Foo(int i) : Foo(bar[i]) {}
int x;
};
I now want to change Foo to a template class, such that:
template <typename T>
struct Foo
{
Foo(int i) : Foo(bar[i]) {}
T x;
};
How do I need to declare extern const struct Foo bar[] now so that the code will compile?