SORU
17 ŞUBAT 2011, PERŞEMBE


C , kopya vektör için ayarla

Std kopyalamak istiyorum::std::vector

std::set <double> input;
input.insert(5);
input.insert(6);

std::vector <double> output;
std::copy(input.begin(), input.end(), output.begin()); //Error: Vector iterator not dereferencable

Sorun nerede o zaman?

CEVAP
17 ŞUBAT 2011, PERŞEMBE


Sadece kullanımına gereken vektör oluşturucu kullanın:

std::set<T> s;

//...

std::vector v( s.begin(), s.end() );

Sadece v nin içeriği istiyorum varsayar, ve verileri kopyalama önce v hiçbir şey yok.

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • colacas

    colacas

    29 EKİM 2006
  • parlophone

    parlophone

    28 ŞUBAT 2006
  • TheGamer2323

    TheGamer2323

    25 Ocak 2009