title: Accessing datamembers of template types
body: <p>I have several POD structs, all who have a common datafield <code>uint32_t gID</code>.</p>
  
  <pre><code>struct component1
  {
     uint32_t ID;
     //Other data
  };
  
  struct component2
  {
     uint32_t ID;
     //Other data
  };
  
  struct component3
  {
     uint32_t ID;
     //Other data
  };
  </code></pre>
  
  <p>I would manage the POD structs with a factory class.</p>
  
  <pre><code>template &lt;class Component&gt;
  class ComponentFactory
  {
      public:
      //Activating/Deactivating components
      private:
      array&lt;Component, 65536&gt; m_components;
  };
  </code></pre>
  
  <p>Now, the location in the m_components array is not always the same as the components ID. How could I write a function for ComponentFactory to return the ID of a component at some index?
  For example,</p>
  
  <pre><code>uint32_t ComponentFactory::getIDatIndex(uint16_t index) 
  {
      //Grab the ID of whatever component the factory manages.
      return m_components[index].ID;
  }
  </code></pre>
  
  <p>Additionally, is it possible to make the ComponentFactory typesafe so that there would not be <code>ComponentFactory&lt;int&gt;</code> or <code>ComponentFactory&lt;char&gt;</code>?</p>