4.9 Iterator
Iteratörlerin Temel Özellikleri
Iteratör Kullanımı
#include <iostream>
#include <vector>
int main() {
// Bir vektör oluşturma
std::vector<int> sayilar = {1, 2, 3, 4, 5};
// Vektör için bir iteratör oluşturma
std::vector<int>::iterator it;
// Elemanları yazdırma
std::cout << "Vektör elemanları: ";
for (it = sayilar.begin(); it != sayilar.end(); ++it) {
std::cout << *it << " "; // Dereferans ile elemanı al
}
std::cout << std::endl;
return 0;
}Reverse Iteratörler
Sonuç
Last updated