title: No viable overloaded operator[] for type
body: <p>I have defined a type:</p>
  
  <pre><code>typedef unordered_map&lt;string, list&lt;string&gt;&gt; Graph;
  </code></pre>
  
  <p>I have a key:</p>
  
  <pre><code>string v = "A12";
  </code></pre>
  
  <p>When I try to access the list using the key:</p>
  
  <pre><code>for (auto w = g[v].begin(); w != g[v].end(); w++)
      {
  
          ...
      }
  </code></pre>
  
  <p>g is type <code>Graph</code>, I get the error:</p>
  
  <pre><code>No viable overloaded operator[] for type 'const Graph'
  </code></pre>
  
  <p>How can I fix this issue?</p>