title: How to print out key and values from a map as a list in C++
body: <p>I am trying to print out more than one record from a map that has a string and a pointer class. This is a follow up from this post: <a href="https://stackoverflow.com/questions/53755459/how-to-dereference-a-pointer-of-a-map-of-pointers-to-objects-in-c">how to dereference a pointer of a map of pointers to objects in c++</a>.
  1. I am having issues on pushing back an object class into a vector. 2. I would like to print more than one record from a map.</p>
  
  <p>I have tried to use vectors but not sure if that's the way to go. I got some errors from it. I know in Java you can use array list so trying to refresh my c++. Any good examples you have following from above link solution.</p>
  
  <pre><code>class Employee
  {
      public:
      int  employeeID;
  
      Employee()
      {
         employeeID = 123;
      } 
   };
  int main(int argc, char* argv[]) {
    std::map&lt;std::string, Employee *&gt; *_employeePayroll;
    std::map&lt;std::string, Employee *&gt; _employeeID;
    std::map&lt;std::string, Employee *&gt;::const_iterator itEmployeeID;
  
    _employeePayroll = &amp;_employeeID;
    (*_employeePayroll)["Karl"] = new Employee;
    (*_employeePayroll)["George"] = new Employee;
  
    vector&lt;std::string&gt; v1;
    v1.push_back(itEmployeeID-&gt;first);
    // Here I am having issues on pushing back an object class into a 
    // vector.  maybe as follows:
    v1..push_back(itEmployeeID-&gt;second);
    v1.shrink_to_fit();
    for ( auto it = v1.begin(); it != v1.end(): it++ )
    {
       std::cout &lt;&lt; *it;
       std::cout &lt;&lt; std::endl;
    }
  
    return 0;
  }
  </code></pre>
  
  <p>I would like to print out more than one record from a map that has a string and a pointer class.</p>