title: new[size] object(args ... ) , GCC parenthesized initializer in array new [-fpermissive]
body: <p>I've a problem with my code that I don't realy understand.</p>
  
  <p>I use «gcc version 4.7.2 (Ubuntu/Linaro 4.7.2-2ubuntu1)»</p>
  
  <hr>
  
  <p>Edit : I use this line to compile </p>
  
  <pre><code>g++ -g -std=c++0x -o "GeneticEngine.o" -c "GeneticEngine.cpp" 
  </code></pre>
  
  <hr>
  
  <p>Here is the Error I have:</p>
  
  <pre><code>GeneticEngine.tpl:16:5: erreur: parenthesized initializer in array new [-fpermissive]
  </code></pre>
  
  <p>And that is my (minimised) code:</p>
  
  <hr>
  
  <p>GeneticEngine.hpp</p>
  
  <pre><code>#include "GeneticThread.hpp"
  
  template &lt;class T&gt;
  class GeneticEngine
  {
      public:
          template &lt;typename ... Args&gt;
          GeneticEngine(int nb_threads,float taux_mut,int tranche_mut,std::string filename,int pop_size,Args&amp; ... args);
  
          /* Other code */
  
  
      private:
          GeneticThread&lt;T&gt;* islands; /* Cause of error */
  
          int size;
  };
  
  #include "GeneticEngine.tpl"
  </code></pre>
  
  <p>GeneticEngine.tpl</p>
  
  <pre><code>template &lt;class T&gt;
  template &lt;typename ... Args&gt;
  GeneticEngine&lt;T&gt;::GeneticEngine(int nb_threads,float taux_mut,int tranche_mut,std::string filename,int pop_size,Args&amp; ... args) : size(nb_threads)
  {
  /*next line is 16 : Error */
   islands = new  GeneticThread&lt;T&gt;[size](taux_mut,tranche_mut,filename,pop_size/nb_threads,std::forward&lt;Args&gt;(args)...);
  };
  </code></pre>
  
  <hr>
  
  <p>GeneticThread.hpp</p>
  
  <pre><code>template &lt;class T&gt;
  class GeneticThread
  {
      public:
          template &lt;typename ... Args&gt;
          GeneticThread(float taux_mut,int tranche_mut,std::string filename,int pop_size,Args&amp; ... args)
          { /* code ... */ };
       /* Other code */
  };
  </code></pre>
  
  <hr>
  
  <p>I have read this (<a href="https://stackoverflow.com/questions/9894406/initializing-arrays-when-using-templates">Initializing arrays when using templates</a>) but it's not exactly the same.</p>
  
  <p>If you have a idea to fix it without having: [finaly I use this :/ ]</p>
  
  <pre><code>GeneticThread&lt;T&gt;** islands;
  islands = new  GeneticThread&lt;T&gt;*[size];
  for(int i=0;i&lt;size;++i)
     islands[i] = new GeneticThread&lt;T&gt;(taux_mut,tranche_mut,filename,pop_size/nb_threads,std::forward&lt;Args&gt;(args)...);
  </code></pre>
  
  <hr>
  
  <p>I want to have:</p>
  
  <pre><code> GeneticThread&lt;T&gt;* islands;
  </code></pre>
  
  <p>Is there a way to do it???</p>
  
  <p>I try:</p>
  
  <pre><code>islands = new  (GeneticThread&lt;T&gt;[size](taux_mut,tranche_mut,filename,pop_size/nb_threads,std::forward&lt;Args&gt;(args)...));
  </code></pre>
  
  <p>and </p>
  
  <pre><code> islands = new  GeneticThread&lt;T&gt;(taux_mut,tranche_mut,filename,pop_size/nb_threads,std::forward&lt;Args&gt;(args)...)[size];
  </code></pre>
  
  <p>But it not work.</p>
  
  <hr>
  
  <p>Thanks.</p>