flat_multiset_begin

flat_multiset_begin (std::flat_multiset::begin — 시작 이터레이터)

std::flat_multiset의 첫 번째 원소를 가리키는 이터레이터를 반환하는 멤버 함수예요. 컨테이너가 비어 있으면 end()와 같아요.

출처: cppreference

본문

시그니처는 다음과 같아요.

iterator begin() noexcept;                 // (1) (since C++23)
const_iterator begin() const noexcept;     // (2) (since C++23)
const_iterator cbegin() const noexcept;    // (3) (since C++23)

flat_multiset의 첫 번째 원소를 가리키는 이터레이터를 반환해요. flat_multiset이 비어 있으면 반환된 이터레이터는 end()와 같아요.

반환값

첫 번째 원소를 가리키는 이터레이터.

복잡도

상수(constant)예요.

참고

iteratorconst_iterator가 모두 상수 이터레이터일(어쩌면 실제로 같은 타입일) 수 있기 때문에, 이 멤버 함수들이 반환한 이터레이터로 컨테이너의 원소를 변경할 수는 없어요.

예제

#include <algorithm>
#include <flat_set>
#include <iostream>
int main()
{
    std::flat_multiset<int> set{3, 1, 4, 1, 5, 9, 2, 6, 5};
    std::for_each(set.cbegin(), set.cend(),
        [](int n){ std::cout << n << ' '; });
    std::cout << '\n';
}

더 알아보기 (Learn more)

cppreference