title: Implementing of container with map inside
body: <p>i want to realize container with map inside and implement operations of insert key/value and get value by key.
  I haven't much exerience in templates usage, and cannot find a mistake.</p>
  
  <p><img src="https://i.stack.imgur.com/gpAIE.png" alt="Screenshot"></p>
  
  <ol>
  <li>Line 1:Error C2663: std::_Tree&lt;_Traits>::find: error C2663: : 2 overloads have no legal;</li>
  <li>Line 2: Error c2664: std::pair&lt;_Ty1,_Ty2> std::_Tree&lt;_Traits>::insert(std::pair &amp;&amp;): param 1 from "std::pair&lt;_Ty1,_Ty2>" в "std::pair&lt;_Ty1,_Ty2> &amp;&amp;";</li>
  </ol>
  
  <p>So i have interface:</p>
  
  <pre><code>IContainer.h
  
  class ElemNotFound {};
  template &lt;class ElemType, class IndexType&gt; 
  class IContainer
  {
  public:
      virtual ~IContainer() {};
      virtual const ElemType&amp; GetElem( const IndexType&amp; index ) const throw ( ElemNotFound ) = 0;
      virtual void PutElem( const IndexType&amp; index, const ElemType&amp; elem ) throw () = 0;
  };
  </code></pre>
  
  <p>And </p>
  
  <pre><code>Container.h
  
  #include &lt;map&gt;
  #include "IContainer.h"
  
  template &lt;class ElemType, class IndexType&gt;
  class Container: public IContainer &lt;ElemType, IndexType&gt;
  {
  private:
      typedef  std::map&lt;ElemType, IndexType&gt; CMap;
      CMap myMap;
  
  public:
      inline const ElemType&amp; GetElem( const IndexType&amp; index ) const throw ( ElemNotFound ) {
  
          auto  it = myMap.find(index); // line 1
  
          if (toRet == end()) {
              throw ElemNotFound();
          }
  
          return toRet-&gt;second;
       }
  
       inline void PutElem( const IndexType&amp; index, const ElemType&amp; elem ) throw () {
           myMap.insert(make_pair(index, elem));  // line 2
       }
  };
  
  int main()
  {
      Container &lt; string, int&gt; c;
      c.PutElem(1, "as");
      c.PutElem(2, "G");
      c.GetElem(2);
  
      return 0;
  }
  </code></pre>