728x90
반응형
Concept
r : reverse
cbegin : 0 ~ cend : last
crbegin : last ~ cend : first
Code
// vector::crbegin/crend
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main ()
{
vector<int> myvector = {1,2,3,4,5};
vector<int>::iterator low,up;
for (auto rit = myvector.crbegin(); rit != myvector.crend(); ++rit)
std::cout << ' ' << *rit;
std::cout << '\n';
for (auto rit = myvector.cbegin(); rit != myvector.cend(); ++rit)
std::cout << ' ' << *rit;
return 0;
}
Result
728x90
반응형
'STUDY' 카테고리의 다른 글
[C++] 람다 함수 (0) | 2022.12.05 |
---|