multiset_begin

multiset_begin (std::multiset::begin — 시작 이터레이터)

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

출처: cppreference

본문

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

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

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

반환값

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

복잡도

상수(constant)예요.

예제

#include <iostream>
#include <set>
int main()
{
    std::multiset<int> s{3, 1, 2, 3};
    for (auto it = s.begin(); it != s.end(); ++it)
        std::cout << *it << ' ';   // 1 2 3 3
}

더 알아보기 (Learn more)

cppreference