Namespaces
Variants

std::flat_map<Key,T,Compare,KeyContainer,MappedContainer>:: end, std::flat_map<Key,T,Compare,KeyContainer,MappedContainer>:: cend

From cppreference.net

iterator end ( ) noexcept ;
(1) (C++23부터)
(C++26부터 constexpr)
const_iterator end ( ) const noexcept ;
(2) (C++23부터)
(C++26부터 constexpr)
const_iterator cend ( ) const noexcept ;
(3) (C++23부터)
(C++26부터 constexpr)

* this 의 마지막 요소 바로 다음을 가리키는 반복자를 반환합니다.

이 반환된 반복자는 단지 센티넬 역할만 합니다. 이것이 dereferenceable 하다는 보장은 없습니다.

range-begin-end.svg

목차

반환값

마지막 요소의 다음을 가리키는 반복자.

복잡도

상수.

예제

#include <iostream>
#include <flat_map>
int main()
{
    std::flat_map<int, double> map{{4, 4.13}, {9, 9.24}, {1, 1.09}};
    for (auto it = map.cbegin(); it != map.cend(); ++it)
        std::cout << '[' << it->first << "] = " << it->second << '\n';
    // std::map의 양방향 반복자와 달리, std::flat_map 반복자는
    // 임의 접근(random-access)이 가능하므로 operator[]와 함께 사용할 수 있습니다:
    auto it = map.cbegin();
    assert(it[0] == map[1]);
    assert(it[1] == map[4]);
    assert(it[2] == map[9]);
}

출력:

[1] = 1.09
[4] = 4.13
[9] = 9.24

참고 항목

시작 부분에 대한 반복자를 반환합니다
(public member function)
(C++11) (C++14)
컨테이너나 배열의 끝에 대한 반복자를 반환합니다
(function template)