title: "C2593: operator = is ambiguous" when populating std::map
body: <p>I have a <code>std::map</code> I'm trying to initialize with an initialization list. I do this in two places, in two different ways. The first one works, while the other one causes the error mentioned in the title.</p>
  
  <p>Here's the one that works:</p>
  
  <pre><code>void foo() {
      static std::map&lt;std::string, std::string&gt; fooMap =
      {
          { "First", "ABC" },
          { "Second", "DEF" }
      };
  }
  </code></pre>
  
  <p>While this one does not:</p>
  
  <pre><code>class Bar {
      public:
          Bar();
      private:
          std::map&lt;std::string, std::string&gt; barMap;
  };
  
  Bar::Bar() {
      barMap = { // &lt;-- this is the error line
          { "First", "ABC" },
          { "Second", "DEF" }
      };
  }
  </code></pre>
  
  <p>Why do I get the error when trying to initialize the class member, while the static map works? At the moment, I can populate the member by first creating a local variable and then swapping it with the member like this:</p>
  
  <pre><code>Bar::Bar() {
      std::map&lt;std::string, std::string&gt; tmpMap = {
          { "First", "ABC" },
          { "Second", "DEF" }
      };
  
      barMap.swap(tmpMap);
  }
  </code></pre>
  
  <p>However, this feels rather counter-intuitive compared to just populating the member directly.</p>
  
  <hr>
  
  <p>EDIT: <a href="http://pastebin.com/wycmCJuG">Here's the compiler output.</a></p>