title: Could not convert from '<brace-enclosed initializer list> to
body: <p>I know that has a lot of questions similar, but I saw them and none of them helped me, I think is that because mine is kind of different, and at the same time weird.</p>
  <p>I made another question and a member answered to me, but instead of using classes he used structs. and it's working perfectly, but when I try to put it as classes, using the same logic, this is what happen, the error:</p>
  <blockquote>
  <p>error: could not convert '{{&quot;foo&quot;, &quot;bar&quot;}}' from '&lt;brace-enclosed initializer list&gt;' to 'B'</p>
  </blockquote>
  <p>I tried, but I don't know what is happening.</p>
  <pre><code>#include &lt;iostream&gt;
  #include &lt;map&gt;
  
  class A
  {
  public:
      A() {}
      A(const std::string &amp; input) : data(input) {}
  private:
      std::string data;
  };
  
  class B
  {
  public:
      B();
      B(std::initializer_list&lt;std::pair&lt;std::string, A&gt;&gt; input) : container(begin(input), end(input)) {}
  private:
      std::map&lt;std::string, A&gt; container;
  };
  
  int main( int argc, char ** argv )
  {
      B b = {
          {&quot;foo&quot;, &quot;bar&quot;}
      };
  
      return 0;
  }
  </code></pre>
  <p>Also the answer of the member here: <a href="http://ideone.com/SeEmVl" rel="nofollow noreferrer">Ideone </a></p>
  <p>Thank you all.</p>