This is basically what I want:
struct Item{ int id; std::string s; }; template <???> struct StaticContainer { static const std::deque<Item> _items; }; template <???> const std::deque<Item> StaticContainer<>::_items {???};
No need to be deque , I just want to link the iterable list of values ββwith type . So that I can do something like
typedef StaticContainer<{{1, "a", {2, "b"}, {3, "c"}}> T1; typedef StaticContainer<{{0, "e"}, {-1, "f"}, {-2, "g"}}> T2; int main() { T1 t1; T2 t2; t1 = t2;
This usually makes things dynamic, which is a problem, but it seems just as difficult to do some dynamic things for compilation. I do not want to use inheritance, polymorphism, and similar runtimes, suggestive approaches.
source share