title: I want to return a VALUE for given KEY for map<> in c++. What to return in case KEY is not present in map<>?
body: <p>I wrote class with template. class has map as member and some getxxx() / setxxx() member functions.</p>
  
  <pre><code>template&lt;typename T1,typename T2&gt;
  class C1{
      map&lt;T1,T2&gt; M;
  public:
      map&lt;T1,T2&gt; getM();
      T2 getMvalue(T1 Key);
      void setM(T1 key,T2 Value);
  };
  </code></pre>
  
  <p>here I want to implement getMvalue(), where it recieves key as argument and returns the corresponding "value" if "key" is available in mapM.</p>
  
  <p>It look something like...</p>
  
  <pre><code>template&lt;typename TKey,typename TValue&gt;
  T2 C1&lt;T1,T2&gt;::getMvalue(T1 Key){
      if(M.count(Key)&gt;0)
          return M[Key];
      else
          return(???);
  };
  </code></pre>
  
  <p>Here I need to use something in place of ???. keeping in mind that return type of function is T2, which can be anything depending on user decision.
  How can i replace "???" and with what?</p>