title: C++ map within map initialization
body: <p>I have a map defined in the following:</p>
  
  <pre><code>map&lt;string, Command&gt; _cmd_map;
  </code></pre>
  
  <p>where <code>Command</code> is a class defined as </p>
  
  <pre><code>class Command {
  public:
  
      const string description;
      const map&lt;string, Argument&gt; *arguments;
      const CommandFunction function;
  
      Command(const string &amp;desc, CommandFunction func, map&lt;string, Argument&gt; *args = nullptr);
      Command(const string &amp;desc, CommandFunction func, const map&lt;string, Argument&gt; &amp;args);
  };
  </code></pre>
  
  <p>How do I initialize this at the beginning of my .cpp? So far I can do it using initializer_list for Command, with *args = nullptr:</p>
  
  <pre><code>const map&lt;string, Command&gt; _cmd_map{
      { "help", Command("Show help menu", (CommandFunction)&amp;(_cmd_help)) },
      { "exit", Command("Exit ", (CommandFunction)&amp;(_cmd_exit)) },
      { "quit", Command("Exit ", (CommandFunction)&amp;(_cmd_exit)) },
  }
  </code></pre>
  
  <p>However I cannot initialize the map inside the Command class this way, without creating a map before and passing it as argument.
  Is it possible to do this directly, like</p>
  
  <pre><code>const map&lt;string, Command&gt; _cmd_map{
  { "quit", Command("Exit ", (CommandFunction)&amp;(_cmd_exit)), 
      {
          {"d1", Argument("Dummy Argument 1")},
          {"d2", Argument("Dummy Argument 2")},
       } 
  }
  }
  </code></pre>