티스토리 뷰
// C++ : Iterator
#include <iostream>
#include <vector>
using namespace std;
int main(int argc, char **argv)
{
vector<int> ivec = { 2, 3, 5, 7 };
for (auto i : ivec)
cout << i << endl;
auto b = ivec.begin();
auto e = ivec.end();
cout << typeid(b).name() << endl;
cout << typeid(e).name() << endl;
while (b != e) {
cout << *b << endl;
++b;
}
getchar();
return 0;
}
/* Output
2
3
5
7
class std::_Vector_iterator<class std::_Vector_val<struct std::_Simple_types<int> > >
class std::_Vector_iterator<class std::_Vector_val<struct std::_Simple_types<int> > >
2
3
5
7
*/
'Series' 카테고리의 다른 글
for [Python] List (0) | 2018.06.20 |
---|---|
for [Python] range (0) | 2018.06.20 |
Generator [Python] my_generator(), yield from (0) | 2018.06.16 |
Generator [Python] infinite_generator(), yield, next() (0) | 2018.06.16 |
Generator [Python] my_generator(), yield (0) | 2018.06.16 |