title: Derived Objects stored in one common container. How to avoid casting
body: <p>Hey dear folks i'm doing this. Probably this is not good.</p>
  
  <pre><code>class Base
  {
  public:
      Base() {}
      virtual ~Base() {}
      //some data
      int a;
  };
  
  class Derived : public Base
  {
  public:
      Derived() {}
      ~Derived() {}
      //some extra data not in base
      int b;
  };
  
  int main()
  {
      std::map&lt;int, Base*&gt; dervivedObjs;
  
      Derived* derived = new Derived;
      dervivedObjs.emplace(0, derived);
  
      Derived* derivedPtr = reinterpret_cast&lt;Derived*&gt;(dervivedObjs.at(0));
  
      return 0;
  }
  </code></pre>
  
  <p>How can avoid casting everytime i need to access some data on a derived class?</p>
  
  <p>or is there a most performant way?</p>