title: 'this' argument to member function has type 'const', but my function is not actually 'const'
body: <p>I have a C++ <code>std::map</code> that I'm using to store information about connected components. Here's the segment of code from my <code>BaseStation</code> class, it's very basic</p>
  
  <pre><code>//Constructor
  BaseStation(string name, int x, int y){
      id = name;
      xpos = x;
      ypos = y;
  }
  
  //Accessors
  string getName(){
      return id;
  }
  </code></pre>
  
  <p>In my main code, I have a map declared as </p>
  
  <p><code>map&lt;BaseStation, vector&lt;string&gt; &gt; connection_map;</code></p>
  
  <p>The <code>connection_map</code> is updated in a while loop as follows, and then for my own debugging purposes I want to dump the contents of the map. I append a BaseStation object to the map (as the key) and as the value we have the list of links to the BaseStation object:</p>
  
  <pre><code>connection_map[BaseStation(station_name, x, y)] = list_of_links; 
  list_of_links.clear();
  
  for(auto ptr = connection_map.begin(); ptr != connection_map.end(); ++ptr){
      cout &lt;&lt; ptr-&gt;first.getName() &lt;&lt; " has the following list: ";
      vector&lt;string&gt; list = ptr-&gt;second;
      for(int i = 0; i &lt; list.size(); i++){
          cout &lt;&lt; list[i] &lt;&lt; " ";
      }
      cout &lt;&lt; endl;
  }
  </code></pre>
  
  <p>This is the error I get in my main when I try to compile my code via clang++:</p>
  
  <pre><code>server.cpp:66:11: error: 'this' argument to member function 'getName' has type
    'const BaseStation', but function is not marked const
              cout &lt;&lt; ptr-&gt;first.getName() &lt;&lt; " has the following list: ";
  </code></pre>
  
  <p>and in VSCode, the tooltip highlight at the cout (<code>cout &lt;&lt; ptr-&gt;first.getName()</code>) is the following:</p>
  
  <pre><code>the object has type qualifiers that are not compatible with the member 
  function "BaseStation::getName" -- object type is: const BaseStation
  </code></pre>
  
  <p>I don't understand what's going on, as the <code>getName()</code> function is most definitely not constant, and nowhere do I declare my <code>BaseStation</code> object as const either. If someone could help me out that would be great. Thanks!</p>