Is the following code correct?
#include <vector>
#include <memory>

using namespace std;

typedef vector<auto_ptr<int> > int_array;

void Test() {
  int_array a;

  for (int i = 0; i < 10; i++) {
    auto_ptr<int> p(new int(i));
    a.push_back(p);
  }
}
Explanation
No, because auto_ptr cannot be used as an element of an STL container.

Слідкуй за CodeGalaxy

Мобільний додаток Beta

Get it on Google Play
Зворотній Зв’язок
Cosmo
Зареєструйся Зараз
або Підпишись на майбутні тести