title: search in nested map C++
body: <p>I have a nested map:</p>
  <pre><code>std::map&lt;std::string,std::map&lt;std::string,float&gt;&gt; registration_by_date_time;
  </code></pre>
  <p>where the key is a string for the date and the value is another map with key a string for time end value a float.</p>
  <p>I have to implement this method:</p>
  <pre><code>float get_registration(const string &amp; date, const string &amp; time) const;
  </code></pre>
  <p>which returns the time series value at date and time or &quot;NaN&quot; in case the value was not previously added in
  the time series.</p>
  <p>My implementation is the following:</p>
  <pre><code>float get_registration(const string &amp; date, const string &amp; time) const{
      if(registration_by_date_time.find(date) != registration_by_date_time.cend())
          if(registration_by_date_time.at(date).find(time) != registration_by_date_time.at(date).cend())
              return registration_by_date_time[date][time];
          else
              return &quot;NaN&quot;;
      else
          return &quot;NaN&quot;;
  }
  </code></pre>
  <p>Is it correct? in particular I wold like to know if I am using correctly .at and if I also could use the access operator [] or &quot;second&quot;.</p>