title: initialization with '{...}' expected for aggregate object
body: <p>I am trying to do string parsing (and it is proving to be a huge pain).  I'm getting this error: "initialization with '{...}' expected for aggregate object "</p>
  
  <p>I have an element defined like this:</p>
  
  <pre><code>Element * currentBar = new Element("Bar");
  </code></pre>
  
  <p>I want to make an array or something to store multiple bars, so I am trying to do something like this:</p>
  
  <pre><code>Element allBars [] = new Element("Bars");
  </code></pre>
  
  <p>I am pretty sure this is not what I want to do, especially since I am getting this error "initialization with '{...}' expected for aggregate object "</p>
  
  <p>This is a segment of my code:</p>
  
  <pre><code>if(!chartDataString.empty()){ 
      chartData.clear();
      int index = 0;
      char c, c1, c2;
      inputMode currentInputMode = inputMode::UNKNOWN;
      Element * cur = NULL;
      while(index&lt;chartDataString.size()){
          c = chartDataString[index];
          c1 = chartDataString[index+1];
          c2 = chartDataString[index+2];
          string s;
          s = c1;
          Element * currentBar = new Element("Bar");
          Element allBars [] = new Element("Bars");                               
              if(c == '*'){
              if(c1 == 'i'){
                  currentBar-&gt;addChild(Element("rehearsalLetter", "info"));
              }
              else{
                  currentBar-&gt;addChild(Element("leftDoubleBarLine", s));
                  index++;
              }
          else if(c == '['){
              currentBar-&gt;addChild(Element("leftDoubleBarLine"));
          }
          else if(c == 'T'){
              string signature = string() + c1 + '/' + c2;
              currentBar-&gt;addChild(Element("timeSignature", signature));
              index += 2;
          }
          //start a new bar
          else if(c == '|'){
              allBars-&gt;addChild(currentBar);
              currentBar = new Element("bar");
          }
  </code></pre>
  
  <p>And my element class just in case it's helpful:</p>
  
  <pre><code>#include &lt;string&gt;
  #include &lt;ostream&gt;
  #include "ArrayList.h"
  
  
  class Element{
  public:
      Element(){}
      Element( const string&amp; _title ){
          title = _title;
      }
      Element( const string&amp; _title, const string&amp; _value){
          title = _title;
          value = _value;
      };
      ~Element(){};
  
      void addChild(Element &amp; child){
          children.add(child);
      }
  
      void serialize(ostream &amp; o ){
          if( children.size() == 0 ){
              o &lt;&lt; "&lt;" &lt;&lt; title &lt;&lt; "&gt;";
              o &lt;&lt; " " &lt;&lt; value &lt;&lt; " ";
              o &lt;&lt; "&lt;/" &lt;&lt; title &lt;&lt; "&gt;";
          }else{
              o &lt;&lt; "&lt;" &lt;&lt; title &lt;&lt; "&gt;" &lt;&lt; endl;
              for( int i = 0; i &lt; children.size(); ++i ){
                  children.elementAt(i).serialize(o);
              }
              o &lt;&lt; "&lt;/" &lt;&lt; title &lt;&lt; "&gt;" &lt;&lt; endl;
          }
      }
  private:
      string title;
      string value;
      ArrayList&lt;Element&gt; children;
  
  };
  </code></pre>