728x90
반응형
std::begin, std::end, iterator
데이터 타입에 맞는 iterator를 리턴한다.
목차
- begin
- end
begin
처음 원소를 가르키는 iterator를 리턴한다.
end
마지막 원소 다음을 가리키는 iterator를 리턴한다.
- 코드
#include <iostream>
#include <vector>
#include <iterator>
using namespace std;
int main()
{
vector<int> v = { 1, 2, 3 };
cout << *begin(v) << endl;
cout << *v.begin() << endl;
cout << v[0] << endl;
}
- 출력
1
1
1
728x90
반응형
'프로그래밍 > C++' 카테고리의 다른 글
C++ std::sort (2) | 2023.01.04 |
---|---|
C++ enum 열거형 (1) | 2023.01.04 |
C++ std::numeric_limits (0) | 2022.02.19 |
C++ std::tuple (0) | 2022.02.19 |
C++ std::pair (0) | 2022.02.19 |