title: Is there a Way to Stream in a Map?
body: <p>I have a file with map entries separated by line, and the keys and values separated by a ':' So something like:</p>
  
  <blockquote>
    <p>one : 1<br>
     two : 2<br>
     three:3<br>
     four : 4</p>
  </blockquote>
  
  <p>I open this in an ifstream called dict and I run the following code:</p>
  
  <pre><code>string key, value;
  map&lt; string, int &gt; mytest;
  
  
  while( getline( dict, key, ':' ).good() &amp;&amp; getline( dict, value ).good() )
  {
      mytest[key] = atoi( value.c_str() );
  }
  </code></pre>
  
  <p>Is there a better way to do this? Is there a getline functionality that would strip spaces from the key? (I'm trying to do this without boost.)</p>