title: How to "push" c++ map like it's done in javascript
body: <p>In C++ I'd like to "push" key/value objects into an array, exactly like I do in JavaScript.</p>
  
  <p>Here is what I would normally do in JavaScript:</p>
  
  <pre><code>var people = [];
  var males = [];
  
  people.push({ name: 'david',age: 45,sex: 'male'});
  people.push({ name: 'mary',age: 22,sex: 'female'});
  people.push({ name: 'alan',age: 52,sex: 'male'});
  people.push({ name: 'fred',age: 19,sex: 'male'});
  people.push({ name: 'alice',age: 33,sex: 'female'});
  
  for (var i = 0; i &lt; people.length; i++)
  {
      if (people[i].sex == 'male')
      {
          males.push({
              name: people[i].name,
              age: people[i].age,
              sex: people[i].sex
          });
      }
  }
  </code></pre>
  
  <p>This is my attempt at it in C++:</p>
  
  <pre><code>int foo()
  {
      std::map&lt;std::string, int&gt; aData;
  
      MySQL my;
      char szQueryText[200] = { '\0' };
      MYSQL_RES *My_result = nullptr;
  
      snprintf(szQueryText, sizeof(szQueryText), "SELECT * FROM %s.object_affixes WHERE objType = %d ORDER BY rowID ASC;", DB_DATA, 1);
      My_result = MySQL__query(szQueryText);
      int num = my.Query(szQueryText);
  
      while (num &gt; 0)
      {
          my.NextRow();
          num--;
  
          aData.insert('rangeFrom', atoi(my.GetData("rangeFrom")));
      }
      MySQL__endquery(My_result);
  </code></pre>
  
  <p>In my C++ example, I'd like to iterate through the while() loop just like I did in the for() loop js example, which I'm doing fine.  In C++ I need to build a new <em>array</em> (just like my males[] js array) and <em>push</em> the iterated data into it.</p>
  
  <p>How do I get C++ std::map to do this correctly?  Do I even use std::map or should I be using something else?</p>