Templates help!

Hi guys,

I'm trying to figure out how I can express something in C++..


The basic idea in C# would be..
 
  private Dictionary<Type, Component[]> _components;


So what I'm really trying to express is I'd like to have a container that has a key related to a type somehow, and the value would be an array of objects that are of the type "specified by" the key. They don't necessarily have to be as explicitly tied together as the C# example. I just don't know how to express this in C++, could someone please help point me in the right direction - how should I be thinking about this in a C++ way?

Would it be something like this? What would go in the blanks?
 
   std::map<?, std::array<?, 1000>> _components;


Thanks for any help!
What about:

 
std::map<std::string, std::array<Component, 1000>> components;

I mean when you put it like that.. haha. I guess I was making it more complicated in my head - I was wanting the key to be a fixed size, and the first template argument to std::array to not be a base class but somehow also specified by templating. It probably makes more sense this way though.
Topic archived. No new replies allowed.