title: Can I create an array of auto_ptr?
body: <p>I have a base class, which is inherited by multiple derived classes. i want to create array of autopointer of baseClass pointer. when i initialise those autopointer i get some compile time error, then i tried to do like that way</p>
  
  <pre><code>std::auto_ptr&lt;base&gt;pbase[3];
  
  std::auto_ptr&lt;base&gt; b1(new derived1());
  std::auto_ptr&lt;base&gt; b2(new derived2());
  std::suto_ptr&lt;base&gt; b3(new derived3());
  
  pbase[0] = b1;
  pbase[1] = b2;
  pbase[2] = b3;
  </code></pre>
  
  <p>it works fine, i fixed the memory leak issue, while i m one windows, i don't use valgrind, i use boost framework for leaks.</p>
  
  <p>for compile error:</p>
  
  <pre><code>class A{
   public:
    std::auto_ptr&lt;base&gt;pbase[2];
  }
  </code></pre>
  
  <p>in A.cpp file</p>
  
  <pre><code>A::A():pbase[0](new derived1()), pbase[1](new derived2()){
  }
  </code></pre>
  
  <p>i got error <code>C2059:syntax error : '['</code></p>