multiset (STL/CLR)

템플릿 클래스는 양방향 액세스 권한이 있는 요소의 다양한 길이 시퀀스를 제어하는 개체를 설명합니다. 컨테이너 multiset 를 사용하여 요소 시퀀스를 각각 하나의 요소를 저장하는 (거의) 균형 잡힌 노드 트리로 관리합니다.

아래 GValueGKey설명에서 후자는 ref 형식이 아닌 경우와 같 Key 으며, 이 경우 Key^동일합니다.

구문

template<typename Key>
    ref class multiset
        :   public
        System::ICloneable,
        System::Collections::IEnumerable,
        System::Collections::ICollection,
        System::Collections::Generic::IEnumerable<GValue>,
        System::Collections::Generic::ICollection<GValue>,
        System::Collections::Generic::IList<GValue>,
        Microsoft::VisualC::StlClr::ITree<Gkey, GValue>
    { ..... };

매개 변수

Key
제어되는 시퀀스에 있는 요소의 키 구성 요소 형식입니다.

요구 사항

헤더:<cliext/set>

네임스페이스:cliext

선언

형식 정의 설명
multiset::const_iterator 제어되는 시퀀스에 대한 상수 반복기의 형식입니다.
multiset::const_reference 요소에 대한 상수 참조의 형식입니다.
multiset::const_reverse_iterator 제어되는 시퀀스에 대한 상수 역방향 반복기의 형식입니다.
multiset::difference_type 두 요소 사이의 (부호 있는) 거리의 형식입니다.
multiset::generic_container 컨테이너에 대한 제네릭 인터페이스의 형식입니다.
multiset::generic_iterator 컨테이너의 제네릭 인터페이스에 대한 반복기의 형식입니다.
multiset::generic_reverse_iterator 컨테이너의 제네릭 인터페이스에 대한 역방향 반복기의 형식입니다.
multiset::generic_value 컨테이너의 제네릭 인터페이스에 대한 요소의 형식입니다.
multiset::iterator 제어되는 시퀀스에 대한 반복기의 형식입니다.
multiset::key_compare 두 키에 대한 순서 지정 대리자입니다.
multiset::key_type 정렬 키의 형식입니다.
multiset::reference 요소에 대한 참조의 형식입니다.
multiset::reverse_iterator 제어되는 시퀀스에 대한 반대 반복기의 형식입니다.
multiset::size_type 두 요소 사이의 (음수가 아닌) 거리의 형식입니다.
multiset::value_compare 두 요소 값에 대한 순서 지정 대리자입니다.
multiset::value_type 요소의 형식입니다.
멤버 함수 설명
multiset::begin 제어되는 시퀀스의 시작을 지정합니다.
multiset::clear 모든 요소를 제거합니다.
multiset::count 지정된 키와 일치하는 요소를 계산합니다.
multiset::empty 요소가 있는지 여부를 테스트합니다.
multiset::end 제어되는 시퀀스의 끝을 지정합니다.
multiset::equal_range 지정된 키와 일치하는 범위를 찾습니다.
multiset::erase 지정된 위치에 있는 요소를 제거합니다.
multiset::find 지정된 키와 일치하는 요소를 찾습니다.
multiset::insert 요소를 추가합니다.
multiset::key_comp 두 키에 대한 순서 지정 대리자를 복사합니다.
multiset::lower_bound 지정된 키와 일치하는 범위의 시작을 찾습니다.
multiset::make_value 값 개체를 생성합니다.
multiset::multiset 컨테이너 개체를 만듭니다.
multiset::rbegin 제어되는 역방향 시퀀스의 시작을 지정합니다.
multiset::rend 제어되는 역방향 시퀀스의 끝을 지정합니다.
multiset::size 요소 수를 계산합니다.
multiset::swap 두 컨테이너의 내용을 바꿉니다.
multiset::to_array 제어된 시퀀스를 새 배열에 복사합니다.
multiset::upper_bound 지정된 키와 일치하는 범위의 끝을 찾습니다.
multiset::value_comp 두 요소 값에 대한 순서 지정 대리자를 복사합니다.
연산자 설명
multiset::operator= 제어되는 시퀀스를 바꿉니다.
operator!= (multiset) 개체가 다른 multiset 개체와 multiset 같지 않은지 여부를 확인합니다.
operator< (multiset) 개체가 다른 multiset 개체보다 작은지 여부를 multiset 확인합니다.
operator<= (multiset) 개체가 다른 multiset 개체보다 작거나 같은지 여부를 multiset 확인합니다.
operator== (multiset) 개체가 다른 multiset 개체와 multiset 같은지 여부를 확인합니다.
operator> (multiset) 개체가 다른 multiset 개체보다 큰지 여부를 multiset 확인합니다.
operator>= (multiset) 개체가 다른 multiset 개체보다 크거나 같은지 여부를 multiset 확인합니다.

인터페이스

인터페이스 설명
ICloneable 개체를 복제합니다.
IEnumerable 요소를 시퀀스합니다.
ICollection 요소 그룹을 유지 관리합니다.
IEnumerable<T> 형식화된 요소를 통한 시퀀스입니다.
ICollection<T> 형식화된 요소 그룹을 유지 관리합니다.
ITree<Key, Value> 일반 컨테이너를 유지 관리합니다.

설명

개체는 개별 노드로 제어하는 시퀀스에 대한 스토리지를 할당하고 해제합니다. 한 노드의 내용을 다른 노드에 복사하지 않고 노드 간 링크를 변경하여 순서가 유지되는 (거의) 균형 잡힌 트리에 요소를 삽입합니다. 즉, 요소를 다시 기본 방해하지 않고 요소를 자유롭게 삽입하고 제거할 수 있습니다.

개체는 형식 multiset::key_compare의 저장된 대리자 개체를 호출하여 제어하는 시퀀스를 정렬합니다. 다중 집합을 생성할 때 저장된 대리자 개체를 지정할 수 있습니다. 대리자 개체를 지정하지 않으면 기본값은 비교 operator<(key_type, key_type)입니다. 멤버 함수 multiset::key_comp를 호출하여 이 저장된 개체에 액세스합니다.

이러한 대리자 개체는 형식 multiset::key_type의 키에 엄격한 약한 순서를 적용해야 합니다. 즉, 두 키 X 에 대해 다음을 Y수행합니다.

key_comp()(X, Y) 는 모든 호출에서 동일한 부울 결과를 반환합니다.

true key_comp()(Y, X) 이면 key_comp()(X, Y) false여야 합니다.

true X 이면 key_comp()(X, Y) 앞에 Y순서를 지정해야 합니다.

true XY 이면 !key_comp()(X, Y) && !key_comp()(Y, X) 동일한 순서를 가지고 있다고 합니다.

제어되는 시퀀스에서 key_comp()(Y, X) 앞에 오는 Y 모든 요소 X 의 경우 false입니다. (기본 대리자 개체의 경우 키 값이 감소하지 않습니다.) 템플릿 클래스 집합(STL/CLR)과 달리 템플릿 클래스 multiset 의 개체는 모든 요소에 대한 키가 고유할 필요가 없습니다. (두 개 이상의 키는 동일한 순서를 가질 수 있습니다.)

각 요소는 키와 값으로 사용됩니다. 시퀀스는 로그 시간에 임의의 요소의 조회, 삽입 및 제거를 허용하는 방식으로 표시됩니다. 즉, 작업 수는 시퀀스의 요소 수 로그에 비례합니다. 또한 요소를 삽입하면 반복기가 무효화되지 않고 요소를 제거하면 제거된 요소를 가리키는 반복기만 무효화됩니다.

A는 multiset 양방향 반복기를 지원합니다. 즉, 제어되는 시퀀스에서 요소를 지정하는 반복기가 지정된 경우 인접한 요소로 단계별로 실행할 수 있습니다. 특수 헤드 노드는 .에서 반환 end()한 반복기에 해당합니다. 제어된 시퀀스의 마지막 요소(있는 경우)에 도달하도록 이 반복기를 감소할 수 있습니다. 반복기를 증 multiset 분하여 헤드 노드에 도달할 수 있으며, 그러면 같음과 end()비교됩니다. 그러나 반환 end()된 반복기를 역참조할 수는 없습니다.

숫자 위치를 지정하면 multiset 요소를 직접 참조할 수 없습니다. 이를 위해서는 임의 액세스 반복기가 필요합니다.

multiset 반복기는 연결된 multiset 노드에 핸들을 저장합니다. 이 노드는 연결된 컨테이너에 대한 핸들을 저장합니다. 연결된 컨테이너 개체에서만 반복기를 사용할 수 있습니다. multiset 반복기는 연결된 multiset 노드가 일부 다중 집합과 연결되어 있는 한 유효합니다기본. 또한 유효한 반복기는 역참조할 수 있습니다. 이 값을 사용하여 지정 end()한 요소 값에 액세스하거나 변경할 수 있습니다.

요소를 지우거나 제거하면 저장된 값에 대한 소멸자가 호출됩니다. 컨테이너를 삭제하면 모든 요소가 지워집니다. 따라서 요소 형식이 ref 클래스인 컨테이너는 컨테이너보다 더 오래 살 요소가 없도록 합니다. 그러나 핸들 컨테이너는 해당 요소를 삭제하지 않습니다.

멤버

multiset::begin

제어되는 시퀀스의 시작을 지정합니다.

구문

iterator begin();

설명

멤버 함수는 제어되는 시퀀스의 첫 번째 요소를 지정하거나 빈 시퀀스의 끝 바로 너머를 지정하는 양방향 반복기를 반환합니다. 이를 사용하여 제어되는 시퀀스의 시작을 지정 current 하는 반복기를 가져오지만 제어되는 시퀀스의 길이가 변경되면 해당 상태 변경될 수 있습니다.

예시

// cliext_multiset_begin.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    c1.insert(L'a');
    c1.insert(L'b');
    c1.insert(L'c');

    // display initial contents " a b c"
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // inspect first two items
    Mymultiset::iterator it = c1.begin();
    System::Console::WriteLine("*begin() = {0}", *it);
    System::Console::WriteLine("*++begin() = {0}", *++it);
    return (0);
    }
a b c
*begin() = a
*++begin() = b

multiset::clear

모든 요소를 제거합니다.

구문

void clear();

설명

멤버 함수는 효과적으로 호출 erase(begin(), end())합니다. 제어된 시퀀스가 비어 있는지 확인하는 데 사용합니다.

예시

// cliext_multiset_clear.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    c1.insert(L'a');
    c1.insert(L'b');
    c1.insert(L'c');

    // display initial contents " a b c"
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // clear the container and reinspect
    c1.clear();
    System::Console::WriteLine("size() = {0}", c1.size());

    // add elements and clear again
    c1.insert(L'a');
    c1.insert(L'b');

    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();
    c1.clear();
    System::Console::WriteLine("size() = {0}", c1.size());
    return (0);
    }
a b c
size() = 0
a b
size() = 0

multiset::const_iterator

제어되는 시퀀스에 대한 상수 반복기의 형식입니다.

구문

typedef T2 const_iterator;

설명

이 형식은 제어되는 시퀀스에 대한 상수 양방향 반복기 역할을 할 수 있는 지정되지 않은 형식 T2 의 개체를 설명합니다.

예시

// cliext_multiset_const_iterator.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    c1.insert(L'a');
    c1.insert(L'b');
    c1.insert(L'c');

    // display contents " a b c"
    Mymultiset::const_iterator cit = c1.begin();
    for (; cit != c1.end(); ++cit)
        System::Console::Write("{0} ", *cit);
    System::Console::WriteLine();
    return (0);
    }
a b c

multiset::const_reference

요소에 대한 상수 참조의 형식입니다.

구문

typedef value_type% const_reference;

설명

이 형식은 요소에 대한 상수 참조를 설명합니다.

예시

// cliext_multiset_const_reference.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    c1.insert(L'a');
    c1.insert(L'b');
    c1.insert(L'c');

    // display initial contents " a b c"
    Mymultiset::const_iterator cit = c1.begin();
    for (; cit != c1.end(); ++cit)
        {   // get a const reference to an element
        Mymultiset::const_reference cref = *cit;
        System::Console::Write("{0} ", cref);
        }
    System::Console::WriteLine();
    return (0);
    }
a b c

multiset::const_reverse_iterator

제어되는 시퀀스에 대한 상수 역방향 반복기의 형식입니다.

구문

typedef T4 const_reverse_iterator;

설명

이 형식은 제어되는 시퀀스에 대한 상수 역방향 반복기 역할을 할 수 있는 지정되지 않은 형식 T4 의 개체를 설명합니다.

예시

// cliext_multiset_const_reverse_iterator.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    c1.insert(L'a');
    c1.insert(L'b');
    c1.insert(L'c');

    // display contents " a b c" reversed
    Mymultiset::const_reverse_iterator crit = c1.rbegin();
    for (; crit != c1.rend(); ++crit)
        System::Console::Write("{0} ", *crit);
    System::Console::WriteLine();
    return (0);
    }
c b a

multiset::count

지정한 키와 일치하는 요소의 수를 찾습니다.

구문

size_type count(key_type key);

매개 변수

key
검색할 키 값입니다.

설명

멤버 함수는 동일한 순서를 가진 제어되는 시퀀스의 요소 수를 반환합니다 key. 이를 사용하여 지정된 키와 일치하는 제어된 시퀀스에 있는 요소의 수를 확인합니다.

예시

// cliext_multiset_count.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    c1.insert(L'a');
    c1.insert(L'b');
    c1.insert(L'c');

    // display initial contents " a b c"
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    System::Console::WriteLine("count(L'A') = {0}", c1.count(L'A'));
    System::Console::WriteLine("count(L'b') = {0}", c1.count(L'b'));
    System::Console::WriteLine("count(L'C') = {0}", c1.count(L'C'));
    return (0);
    }
a b c
count(L'A') = 0
count(L'b') = 1
count(L'C') = 0

multiset::difference_type

두 요소 사이의 부가된 거리 형식입니다.

구문

typedef int difference_type;

설명

이 형식은 음수 요소 수를 설명합니다.

예시

// cliext_multiset_difference_type.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    c1.insert(L'a');
    c1.insert(L'b');
    c1.insert(L'c');

    // display initial contents " a b c"
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // compute positive difference
    Mymultiset::difference_type diff = 0;
    for (Mymultiset::iterator it = c1.begin(); it != c1.end(); ++it)
        ++diff;
    System::Console::WriteLine("end()-begin() = {0}", diff);

    // compute negative difference
    diff = 0;
    for (Mymultiset::iterator it = c1.end(); it != c1.begin(); --it)
        --diff;
    System::Console::WriteLine("begin()-end() = {0}", diff);
    return (0);
    }
a b c
end()-begin() = 3
begin()-end() = -3

multiset::empty

요소가 있는지 여부를 테스트합니다.

구문

bool empty();

설명

멤버 함수는 빈 제어되는 시퀀스에 대해 true를 반환합니다. 이 값은 .에 해당합니다 size() == 0. 이 값을 사용하여 비어 있는지 여부를 테스트합니다 multiset .

예시

// cliext_multiset_empty.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    c1.insert(L'a');
    c1.insert(L'b');
    c1.insert(L'c');

    // display initial contents " a b c"
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();
    System::Console::WriteLine("size() = {0}", c1.size());
    System::Console::WriteLine("empty() = {0}", c1.empty());

    // clear the container and reinspect
    c1.clear();
    System::Console::WriteLine("size() = {0}", c1.size());
    System::Console::WriteLine("empty() = {0}", c1.empty());
    return (0);
    }
a b c
size() = 3
empty() = False
size() = 0
empty() = True

multiset::end

제어되는 시퀀스의 끝을 지정합니다.

구문

iterator end();

설명

멤버 함수는 제어되는 시퀀스의 끝 바로 다음을 가리키는 양방향 반복기를 반환합니다. 제어되는 시퀀스의 끝을 지정하는 반복기를 가져오는 데 사용합니다. 제어되는 시퀀스의 길이가 변경되면 해당 상태 변경되지 않습니다.

예시

// cliext_multiset_end.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    c1.insert(L'a');
    c1.insert(L'b');
    c1.insert(L'c');

    // display initial contents " a b c"
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // inspect last two items
    Mymultiset::iterator it = c1.end();
    --it;
    System::Console::WriteLine("*-- --end() = {0}", *--it);
    System::Console::WriteLine("*--end() = {0}", *++it);
    return (0);
    }
a b c
*-- --end() = b
*--end() = c

multiset::equal_range

지정된 키와 일치하는 범위를 찾습니다.

구문

cliext::pair<iterator, iterator> equal_range(key_type key);

매개 변수

key
검색할 키 값입니다.

설명

멤버 함수는 반복기 쌍을 반환합니다 cliext::pair<iterator, iterator>(lower_bound(key), upper_bound(key)). 이를 사용하여 지정된 키와 일치하는 제어된 시퀀스에 있는 요소의 범위를 확인합니다.

예시

// cliext_multiset_equal_range.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
typedef Mymultiset::pair_iter_iter Pairii;
int main()
    {
    Mymultiset c1;
    c1.insert(L'a');
    c1.insert(L'b');
    c1.insert(L'c');

    // display initial contents " a b c"
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // display results of failed search
    Pairii pair1 = c1.equal_range(L'x');
    System::Console::WriteLine("equal_range(L'x') empty = {0}",
        pair1.first == pair1.second);

    // display results of successful search
    pair1 = c1.equal_range(L'b');
    for (; pair1.first != pair1.second; ++pair1.first)
        System::Console::Write("{0} ", *pair1.first);
    System::Console::WriteLine();
    return (0);
    }
a b c
equal_range(L'x') empty = True
b

multiset::erase

지정된 위치에 있는 요소를 제거합니다.

구문

iterator erase(iterator where);
iterator erase(iterator first, iterator last);
size_type erase(key_type key)

매개 변수

first
지울 범위의 시작입니다.

key
지울 키 값입니다.

last
지울 범위의 끝입니다.

where
지울 요소입니다.

설명

첫 번째 멤버 함수는 제어되는 시퀀스의 where요소를 제거하고 제거된 요소를 벗어나거나 end() 해당 요소가 없는 경우 기본 첫 번째 요소를 다시 지정하는 반복기를 반환합니다. 단일 요소를 제거하는 데 사용합니다.

두 번째 멤버 함수는 범위[first, last)에서 제어되는 시퀀스의 요소를 제거하고 첫 번째 요소를 다시 지정하는 반복기를 반환합니다기본 제거된 요소를 벗어나거나 end() 해당 요소가 없는 경우. 0개 이상의 연속 요소를 제거하는 데 사용합니다.

세 번째 멤버 함수는 키가 동일한 순서 key를 갖는 제어되는 시퀀스의 요소를 제거하고 제거된 요소의 개수를 반환합니다. 지정된 키와 일치하는 모든 요소를 제거하고 계산하는 데 사용합니다.

각 요소 삭제는 제어되는 시퀀스의 요소 수 로그에 비례하여 시간이 걸립니다.

예시

// cliext_multiset_erase.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    c1.insert(L'a');
    c1.insert(L'b');
    c1.insert(L'c');

    // display initial contents " a b c"
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // erase an element and reinspect
    System::Console::WriteLine("erase(begin()) = {0}",
        *c1.erase(c1.begin()));

    // add elements and display " b c d e"
    c1.insert(L'd');
    c1.insert(L'e');
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // erase all but end
    Mymultiset::iterator it = c1.end();
    System::Console::WriteLine("erase(begin(), end()-1) = {0}",
        *c1.erase(c1.begin(), --it));
    System::Console::WriteLine("size() = {0}", c1.size());
    return (0);
    }
a b c
erase(begin()) = b
b c d e
erase(begin(), end()-1) = e
size() = 1

multiset::find

지정된 키와 일치하는 요소를 찾습니다.

구문

iterator find(key_type key);

매개 변수

key
검색할 키 값입니다.

설명

제어되는 시퀀스의 하나 이상의 요소에 동일한 순서가 key있는 경우 멤버 함수는 해당 요소 중 하나를 지정하는 반복기를 반환하고, 그렇지 않으면 반환됩니다 end(). 이를 사용하여 지정된 키와 일치하는 제어된 시퀀스에서 현재 요소를 찾습니다.

예시

// cliext_multiset_find.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    c1.insert(L'a');
    c1.insert(L'b');
    c1.insert(L'c');

    // display initial contents " a b c"
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    System::Console::WriteLine("find {0} = {1}",
        L'A', c1.find(L'A') != c1.end());
    System::Console::WriteLine("find {0} = {1}",
        L'b', *c1.find(L'b'));
    System::Console::WriteLine("find {0} = {1}",
        L'C', c1.find(L'C') != c1.end());
    return (0);
    }
a b c
find A = False
find b = b
find C = False

multiset::generic_container

컨테이너에 대한 제네릭 인터페이스의 형식입니다.

구문

typedef Microsoft::VisualC::StlClr::
    ITree<GKey, GValue>
    generic_container;

설명

이 형식은 이 템플릿 컨테이너 클래스에 대한 제네릭 인터페이스를 설명합니다.

예시

// cliext_multiset_generic_container.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    c1.insert(L'a');
    c1.insert(L'b');
    c1.insert(L'c');

    // display contents " a b c"
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // construct a generic container
    Mymultiset::generic_container^ gc1 = %c1;
    for each (wchar_t elem in gc1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // modify generic and display original
    gc1->insert(L'd');
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // modify original and display generic
    c1.insert(L'e');
    for each (wchar_t elem in gc1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();
    return (0);
    }
a b c
a b c
a b c d
a b c d e

multiset::generic_iterator

컨테이너에 대한 제네릭 인터페이스와 함께 사용할 반복기의 형식입니다.

구문

typedef Microsoft::VisualC::StlClr::Generic::
    ContainerBidirectionalIterator<generic_value>
    generic_iterator;

설명

이 형식은 이 템플릿 컨테이너 클래스에 대한 제네릭 인터페이스와 함께 사용할 수 있는 제네릭 반복기를 설명합니다.

예시

// cliext_multiset_generic_iterator.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    c1.insert(L'a');
    c1.insert(L'b');
    c1.insert(L'c');

    // display contents " a b c"
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // construct a generic container
    Mymultiset::generic_container^ gc1 = %c1;
    for each (wchar_t elem in gc1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // get an element and display it
    Mymultiset::generic_iterator gcit = gc1->begin();
    Mymultiset::generic_value gcval = *gcit;
    System::Console::WriteLine("{0} ", gcval);
    return (0);
    }
a b c
a b c
a

multiset::generic_reverse_iterator

컨테이너의 제네릭 인터페이스와 함께 사용할 역방향 반복기의 형식입니다.

구문

typedef Microsoft::VisualC::StlClr::Generic::
    ReverseRandomAccessIterator<generic_value>
    generic_reverse_iterator;

설명

이 형식은 이 템플릿 컨테이너 클래스에 대한 제네릭 인터페이스와 함께 사용할 수 있는 제네릭 역방향 반복기를 설명합니다.

예시

// cliext_multiset_generic_reverse_iterator.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    c1.insert(L'a');
    c1.insert(L'b');
    c1.insert(L'c');

    // display contents " a b c"
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // construct a generic container
    Mymultiset::generic_container^ gc1 = %c1;
    for each (wchar_t elem in gc1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // get an element and display it
    Mymultiset::generic_reverse_iterator gcit = gc1->rbegin();
    Mymultiset::generic_value gcval = *gcit;
    System::Console::WriteLine("{0} ", gcval);
    return (0);
    }
a b c
a b c
c

multiset::generic_value

컨테이너에 대한 제네릭 인터페이스와 함께 사용할 요소의 형식입니다.

구문

typedef GValue generic_value;

설명

이 형식은 이 템플릿 컨테이너 클래스의 제네릭 인터페이스와 함께 사용할 저장된 요소 값을 설명하는 형식 GValue 의 개체를 설명합니다.

예시

// cliext_multiset_generic_value.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    c1.insert(L'a');
    c1.insert(L'b');
    c1.insert(L'c');

    // display contents " a b c"
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // construct a generic container
    Mymultiset::generic_container^ gc1 = %c1;
    for each (wchar_t elem in gc1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // get an element and display it
    Mymultiset::generic_iterator gcit = gc1->begin();
    Mymultiset::generic_value gcval = *gcit;
    System::Console::WriteLine("{0} ", gcval);
    return (0);
    }
a b c
a b c
a

multiset::insert

요소를 추가합니다.

구문

iterator insert(value_type val);
iterator insert(iterator where, value_type val);
template<typename InIter>
    void insert(InIter first, InIter last);
void insert(System::Collections::Generic::IEnumerable<value_type>^ right);

매개 변수

first
삽입할 범위의 시작 부분입니다.

last
삽입할 범위의 끝입니다.

right
삽입할 열거형입니다.

val
삽입할 키 값입니다.

where
삽입할 컨테이너의 위치(힌트만 해당).

설명

각 멤버 함수는 다시 기본 피연산자에서 지정한 시퀀스를 삽입합니다.

첫 번째 멤버 함수는 값 val이 있는 요소를 삽입하고 새로 삽입된 요소를 지정하는 반복기를 반환합니다. 단일 요소를 삽입하는 데 사용합니다.

두 번째 멤버 함수는 힌트로 사용하여 whereval이 있는 요소를 삽입하고 새로 삽입된 요소를 지정하는 반복기를 반환합니다. 이를 사용하여 알고 있는 요소 옆에 있을 수 있는 단일 요소를 삽입합니다.

세 번째 멤버 함수는 시퀀스 [, last)를first 삽입합니다. 다른 시퀀스에서 복사한 요소를 0개 이상 삽입하는 데 사용합니다.

네 번째 멤버 함수는 .에 의해 right지정된 시퀀스를 삽입합니다. 열거자가 설명하는 시퀀스를 삽입하는 데 사용합니다.

각 요소 삽입은 제어되는 시퀀스의 요소 수 로그에 비례하여 시간이 걸립니다. 그러나 삽입 지점 옆의 요소를 지정하는 힌트가 있으면 분할 상환 상수 시간에 삽입이 발생할 수 있습니다.

예시

// cliext_multiset_insert.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    c1.insert(L'a');
    c1.insert(L'b');
    c1.insert(L'c');

    // display initial contents " a b c"
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // insert a single value, unique and duplicate
    System::Console::WriteLine("insert(L'x') = {0}",
        *c1.insert(L'x'));

    System::Console::WriteLine("insert(L'b') = {0}",
        *c1.insert(L'b'));

    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // insert a single value with hint
    System::Console::WriteLine("insert(begin(), L'y') = {0}",
        *c1.insert(c1.begin(), L'y'));
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // insert an iterator range
    Mymultiset c2;
    Mymultiset::iterator it = c1.end();
    c2.insert(c1.begin(), --it);
    for each (wchar_t elem in c2)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // insert an enumeration
    Mymultiset c3;
    c3.insert(   // NOTE: cast is not needed
        (System::Collections::Generic::IEnumerable<wchar_t>^)%c1);
    for each (wchar_t elem in c3)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();
    return (0);
    }
a b c
insert(L'x') = x
insert(L'b') = b
a b b c x
insert(begin(), L'y') = y
a b b c x y
a b b c x
a b b c x y

multiset::iterator

제어되는 시퀀스에 대한 반복기의 형식입니다.

구문

typedef T1 iterator;

설명

형식은 제어되는 시퀀스에 대한 양방향 반복기 역할을 할 수 있는 지정되지 않은 형식 T1 의 개체를 설명합니다.

예시

// cliext_multiset_iterator.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    c1.insert(L'a');
    c1.insert(L'b');
    c1.insert(L'c');

    // display contents " a b c"
    Mymultiset::iterator it = c1.begin();
    for (; it != c1.end(); ++it)
        System::Console::Write("{0} ", *it);
    System::Console::WriteLine();
    return (0);
    }
a b c

multiset::key_comp

두 키에 대한 순서 지정 대리자를 복사합니다.

구문

key_compare^key_comp();

설명

멤버 함수는 제어되는 시퀀스를 정렬하는 데 사용되는 순서 지정 대리자를 반환합니다. 두 키를 비교하는 데 사용합니다.

예시

// cliext_multiset_key_comp.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    Mymultiset::key_compare^ kcomp = c1.key_comp();

    System::Console::WriteLine("compare(L'a', L'a') = {0}",
        kcomp(L'a', L'a'));
    System::Console::WriteLine("compare(L'a', L'b') = {0}",
        kcomp(L'a', L'b'));
    System::Console::WriteLine("compare(L'b', L'a') = {0}",
        kcomp(L'b', L'a'));
    System::Console::WriteLine();

    // test a different ordering rule
    Mymultiset c2 = cliext::greater<wchar_t>();
    kcomp = c2.key_comp();

    System::Console::WriteLine("compare(L'a', L'a') = {0}",
        kcomp(L'a', L'a'));
    System::Console::WriteLine("compare(L'a', L'b') = {0}",
        kcomp(L'a', L'b'));
    System::Console::WriteLine("compare(L'b', L'a') = {0}",
        kcomp(L'b', L'a'));
    return (0);
    }
compare(L'a', L'a') = False
compare(L'a', L'b') = True
compare(L'b', L'a') = False

compare(L'a', L'a') = False
compare(L'a', L'b') = False
compare(L'b', L'a') = True

multiset::key_compare

두 키에 대한 순서 지정 대리자입니다.

구문

Microsoft::VisualC::StlClr::BinaryDelegate<GKey, GKey, bool>
    key_compare;

설명

형식은 해당 키 인수의 순서를 결정하는 대리자의 동의어입니다.

예시

// cliext_multiset_key_compare.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    Mymultiset::key_compare^ kcomp = c1.key_comp();

    System::Console::WriteLine("compare(L'a', L'a') = {0}",
        kcomp(L'a', L'a'));
    System::Console::WriteLine("compare(L'a', L'b') = {0}",
        kcomp(L'a', L'b'));
    System::Console::WriteLine("compare(L'b', L'a') = {0}",
        kcomp(L'b', L'a'));
    System::Console::WriteLine();

    // test a different ordering rule
    Mymultiset c2 = cliext::greater<wchar_t>();
    kcomp = c2.key_comp();

    System::Console::WriteLine("compare(L'a', L'a') = {0}",
        kcomp(L'a', L'a'));
    System::Console::WriteLine("compare(L'a', L'b') = {0}",
        kcomp(L'a', L'b'));
    System::Console::WriteLine("compare(L'b', L'a') = {0}",
        kcomp(L'b', L'a'));
    return (0);
    }
compare(L'a', L'a') = False
compare(L'a', L'b') = True
compare(L'b', L'a') = False

compare(L'a', L'a') = False
compare(L'a', L'b') = False
compare(L'b', L'a') = True

multiset::key_type

정렬 키의 형식입니다.

구문

typedef Key key_type;

설명

이 형식은 템플릿 매개 변수 Key의 동의어입니다.

예시

// cliext_multiset_key_type.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    c1.insert(L'a');
    c1.insert(L'b');
    c1.insert(L'c');

    // display contents " a b c" using key_type
    for (Mymultiset::iterator it = c1.begin(); it != c1.end(); ++it)
        {   // store element in key_type object
        Mymultiset::key_type val = *it;

        System::Console::Write("{0} ", val);
        }
    System::Console::WriteLine();
    return (0);
    }
a b c

multiset::lower_bound

지정된 키와 일치하는 범위의 시작을 찾습니다.

구문

iterator lower_bound(key_type key);

매개 변수

key
검색할 키 값입니다.

설명

멤버 함수는 제어되는 시퀀스의 첫 번째 요소에 해당하는 순서가 있는 요소를 X 결정합니다 key. 이러한 요소가 없으면 반환 end()됩니다. 그렇지 않으면 지정하는 반복기를 반환합니다 X. 이를 사용하여 지정된 키와 일치하는 제어된 시퀀스에서 현재 요소 시퀀스의 시작을 찾습니다.

예시

// cliext_multiset_lower_bound.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    c1.insert(L'a');
    c1.insert(L'b');
    c1.insert(L'c');

    // display initial contents " a b c"
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    System::Console::WriteLine("lower_bound(L'x')==end() = {0}",
        c1.lower_bound(L'x') == c1.end());

    System::Console::WriteLine("*lower_bound(L'a') = {0}",
        *c1.lower_bound(L'a'));
    System::Console::WriteLine("*lower_bound(L'b') = {0}",
        *c1.lower_bound(L'b'));
    return (0);
    }
a b c
lower_bound(L'x')==end() = True
*lower_bound(L'a') = a
*lower_bound(L'b') = b

multiset::make_value

값 개체를 생성합니다.

구문

static value_type make_value(key_type key);

매개 변수

key
사용할 키 값입니다.

설명

멤버 함수는 키가 key.인 개체를 value_type 반환합니다. 이 함수를 사용하여 다른 여러 멤버 함수와 함께 사용하기에 적합한 개체를 작성합니다.

예시

// cliext_multiset_make_value.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    c1.insert(Mymultiset::make_value(L'a'));
    c1.insert(Mymultiset::make_value(L'b'));
    c1.insert(Mymultiset::make_value(L'c'));

    // display contents " a b c"
    for each (Mymultiset::value_type elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();
    return (0);
    }
a b c

multiset::multiset

컨테이너 개체를 만듭니다.

구문

multiset();
explicit multiset(key_compare^ pred);
multiset(multiset<Key>% right);
multiset(multiset<Key>^ right);
template<typename InIter>
    multisetmultiset(InIter first, InIter last);
template<typename InIter>
    multiset(InIter first, InIter last,
        key_compare^ pred);
multiset(System::Collections::Generic::IEnumerable<GValue>^ right);
multiset(System::Collections::Generic::IEnumerable<GValue>^ right,
    key_compare^ pred);

매개 변수

first
삽입할 범위의 시작 부분입니다.

last
삽입할 범위의 끝입니다.

pred
제어되는 시퀀스에 대한 조건자 순서 지정

right
삽입할 개체 또는 범위입니다.

설명

생성자:

multiset();

기본 순서 조건자를 사용하여 요소 없이 제어되는 시퀀스를 초기화합니다 key_compare(). 기본 순서 조건자를 사용하여 빈 초기 제어 시퀀스를 지정하는 데 사용합니다.

생성자:

explicit multiset(key_compare^ pred);

순서 조건자를 사용하여 요소 없이 제어되는 시퀀스를 초기화합니다 pred. 지정된 순서 조건자를 사용하여 빈 초기 제어 시퀀스를 지정하는 데 사용합니다.

생성자:

multiset(multiset<Key>% right);

는 기본 순서 조건자를 사용하여 시퀀스 [right.begin(), right.end())를 사용하여 제어되는 시퀀스를 초기화합니다. 기본 순서 조건자를 사용하여 개체right에 의해 multiset 제어되는 시퀀스의 복사본인 초기 제어 시퀀스를 지정하는 데 사용합니다.

생성자:

multiset(multiset<Key>^ right);

는 기본 순서 조건자를 사용하여 시퀀스 [right->begin(), right->end())를 사용하여 제어되는 시퀀스를 초기화합니다. 기본 순서 조건자를 사용하여 개체right에 의해 multiset 제어되는 시퀀스의 복사본인 초기 제어 시퀀스를 지정하는 데 사용합니다.

생성자:

template<typename InIter> multiset(InIter first, InIter last);

는 기본 순서 조건자를 사용하여 시퀀스 [first, last)를 사용하여 제어되는 시퀀스를 초기화합니다. 제어된 시퀀스를 기본 순서 조건자를 사용하여 다른 시퀀스의 복사본으로 만드는 데 사용합니다.

생성자:

template<typename InIter> multiset(InIter first, InIter last, key_compare^ pred);

순서 조건자를 사용하여 시퀀스 [first, last)를 사용하여 제어되는 시퀀스를 초기화합니다 pred. 제어되는 시퀀스를 지정된 순서 조건자를 사용하여 다른 시퀀스의 복사본으로 만드는 데 사용합니다.

생성자:

multiset(System::Collections::Generic::IEnumerable<Key>^ right);

는 기본 순서 조건자를 사용하여 열거자가 right지정한 시퀀스를 사용하여 제어되는 시퀀스를 초기화합니다. 제어되는 시퀀스를 기본 순서 조건자를 사용하여 열거자가 설명하는 다른 시퀀스의 복사본으로 만드는 데 사용합니다.

생성자:

multiset(System::Collections::Generic::IEnumerable<Key>^ right, key_compare^ pred);

순서 조건자를 사용하여 열거자가 right지정한 시퀀스를 사용하여 제어되는 시퀀스를 초기화합니다 pred. 제어되는 시퀀스를 지정된 순서 조건자를 사용하여 열거자가 설명하는 다른 시퀀스의 복사본으로 만드는 데 사용합니다.

예시

// cliext_multiset_construct.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
// construct an empty container
    Mymultiset c1;
    System::Console::WriteLine("size() = {0}", c1.size());

    c1.insert(L'a');
    c1.insert(L'b');
    c1.insert(L'c');
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // construct with an ordering rule
    Mymultiset c2 = cliext::greater_equal<wchar_t>();
    System::Console::WriteLine("size() = {0}", c2.size());

    c2.insert(c1.begin(), c1.end());
    for each (wchar_t elem in c2)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // construct with an iterator range
    Mymultiset c3(c1.begin(), c1.end());
    for each (wchar_t elem in c3)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // construct with an iterator range and an ordering rule
    Mymultiset c4(c1.begin(), c1.end(),
        cliext::greater_equal<wchar_t>());
    for each (wchar_t elem in c4)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // construct with an enumeration
    Mymultiset c5(   // NOTE: cast is not needed
        (System::Collections::Generic::IEnumerable<wchar_t>^)%c3);
    for each (wchar_t elem in c5)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // construct with an enumeration and an ordering rule
    Mymultiset c6(   // NOTE: cast is not needed
        (System::Collections::Generic::IEnumerable<wchar_t>^)%c3,
            cliext::greater_equal<wchar_t>());
    for each (wchar_t elem in c6)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // construct from a generic container
    Mymultiset c7(c4);
    for each (wchar_t elem in c7)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // construct by copying another container
    Mymultiset c8(%c3);
    for each (wchar_t elem in c8)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();
    return (0);
    }
size() = 0
a b c
size() = 0
c b a
a b c
c b a
a b c
c b a
c b a
a b c

multiset::operator=

제어되는 시퀀스를 바꿉니다.

구문

multiset<Key>% operator=(multiset<Key>% right);

매개 변수

right
복사할 컨테이너입니다.

설명

멤버 연산자는 개체에 복사한 다음 반환합니다 right*this. 이를 사용하여 제어되는 시퀀스를 right의 제어되는 시퀀스 복사본으로 대체합니다.

예시

// cliext_multiset_operator_as.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    c1.insert(L'a');
    c1.insert(L'b');
    c1.insert(L'c');

    // display contents " a b c"
    for each (Mymultiset::value_type elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // assign to a new container
    Mymultiset c2;
    c2 = c1;
// display contents " a b c"
    for each (Mymultiset::value_type elem in c2)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();
    return (0);
    }
a b c
a b c

multiset::rbegin

제어되는 역방향 시퀀스의 시작을 지정합니다.

구문

reverse_iterator rbegin();

설명

멤버 함수는 제어되는 시퀀스의 마지막 요소를 지정하거나 빈 시퀀스의 시작 부분 바로 너머를 지정하는 역방향 반복기를 반환합니다. 따라서 역방향 시퀀스를 지정합니다 beginning . 이를 사용하여 역순으로 표시되는 제어되는 시퀀스의 시작을 지정 current 하는 반복기를 가져오지만 제어되는 시퀀스의 길이가 변경되면 해당 상태 변경될 수 있습니다.

예시

// cliext_multiset_rbegin.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    c1.insert(L'a');
    c1.insert(L'b');
    c1.insert(L'c');

    // display initial contents " a b c"
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // inspect first two items in reversed sequence
    Mymultiset::reverse_iterator rit = c1.rbegin();
    System::Console::WriteLine("*rbegin() = {0}", *rit);
    System::Console::WriteLine("*++rbegin() = {0}", *++rit);
    return (0);
    }
a b c
*rbegin() = c
*++rbegin() = b

multiset::reference

요소에 대한 참조의 형식입니다.

구문

typedef value_type% reference;

설명

이 형식은 요소에 대한 참조를 설명합니다.

예시

// cliext_multiset_reference.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    c1.insert(L'a');
    c1.insert(L'b');
    c1.insert(L'c');

    // display initial contents " a b c"
    Mymultiset::iterator it = c1.begin();
    for (; it != c1.end(); ++it)
        {   // get a reference to an element
        Mymultiset::reference ref = *it;
        System::Console::Write("{0} ", ref);
        }
    System::Console::WriteLine();
    return (0);
    }
a b c

multiset::rend

제어되는 역방향 시퀀스의 끝을 지정합니다.

구문

reverse_iterator rend();

설명

멤버 함수는 제어되는 시퀀스의 시작 부분 바로 앞을 가리키는 역방향 반복기를 반환합니다. 따라서 역방향 시퀀스를 지정합니다 end . 이를 사용하여 제어되는 시퀀스의 끝을 역순으로 표시하는 current 반복기를 가져오지만 제어되는 시퀀스의 길이가 변경되면 해당 상태 변경될 수 있습니다.

예시

// cliext_multiset_rend.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    c1.insert(L'a');
    c1.insert(L'b');
    c1.insert(L'c');

    // display initial contents " a b c"
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // inspect first two items
    Mymultiset::reverse_iterator rit = c1.rend();
    --rit;
    System::Console::WriteLine("*-- --rend() = {0}", *--rit);
    System::Console::WriteLine("*--rend() = {0}", *++rit);
    return (0);
    }
a b c
*-- --rend() = b
*--rend() = a

multiset::reverse_iterator

제어되는 시퀀스에 대한 반대 반복기의 형식입니다.

구문

typedef T3 reverse_iterator;

설명

이 형식은 제어된 시퀀스에 대해 반대 반복기로 사용될 수 있는 지정되지 않은 T3 형식의 개체를 설명합니다.

예시

// cliext_multiset_reverse_iterator.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    c1.insert(L'a');
    c1.insert(L'b');
    c1.insert(L'c');

    // display contents " a b c" reversed
    Mymultiset::reverse_iterator rit = c1.rbegin();
    for (; rit != c1.rend(); ++rit)
        System::Console::Write("{0} ", *rit);
    System::Console::WriteLine();
    return (0);
    }
c b a

multiset::size

요소 수를 계산합니다.

구문

size_type size();

설명

멤버 함수는 제어되는 시퀀스의 길이를 반환합니다. 이를 사용하여 현재 제어되는 시퀀스에 있는 요소 수를 확인합니다. 시퀀스의 크기가 0이 아닌지 여부만 있으면 다음을 참조하세요 empty().

예시

// cliext_multiset_size.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    c1.insert(L'a');
    c1.insert(L'b');
    c1.insert(L'c');

    // display initial contents " a b c"
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();
    System::Console::WriteLine("size() = {0} starting with 3", c1.size());

    // clear the container and reinspect
    c1.clear();
    System::Console::WriteLine("size() = {0} after clearing", c1.size());

    // add elements and clear again
    c1.insert(L'a');
    c1.insert(L'b');
    System::Console::WriteLine("size() = {0} after adding 2", c1.size());
    return (0);
    }
a b c
size() = 3 starting with 3
size() = 0 after clearing
size() = 2 after adding 2

multiset::size_type

두 요소 사이의 부호가 있는 거리의 형식입니다.

구문

typedef int size_type;

설명

이 형식은 음수가 아닌 요소 수를 설명합니다.

예시

// cliext_multiset_size_type.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    c1.insert(L'a');
    c1.insert(L'b');
    c1.insert(L'c');

    // display initial contents " a b c"
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // compute positive difference
    Mymultiset::size_type diff = 0;
    for (Mymultiset::iterator it = c1.begin(); it != c1.end(); ++it)
        ++diff;
    System::Console::WriteLine("end()-begin() = {0}", diff);
    return (0);
    }
a b c
end()-begin() = 3

multiset::swap

두 컨테이너의 내용을 바꿉니다.

구문

void swap(multiset<Key>% right);

매개 변수

right
콘텐츠와 바꿀 컨테이너입니다.

설명

멤버 함수는 thisright 간에 제어된 시퀀스를 교환합니다. 그것은 일정한 시간에 그렇게하고 예외를 throw하지 않습니다. 두 컨테이너의 콘텐츠를 빠르게 교환하는 방법으로 사용합니다.

예시

// cliext_multiset_swap.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    c1.insert(L'a');
    c1.insert(L'b');
    c1.insert(L'c');

    // display initial contents " a b c"
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // construct another container with repetition of values
    Mymultiset c2;
    c2.insert(L'd');
    c2.insert(L'e');
    c2.insert(L'f');
    for each (wchar_t elem in c2)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // swap and redisplay
    c1.swap(c2);
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    for each (wchar_t elem in c2)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();
    return (0);
    }
a b c
d e f
d e f
a b c

multiset::to_array

제어된 시퀀스를 새 배열에 복사합니다.

구문

cli::array<value_type>^ to_array();

설명

멤버 함수는 제어되는 시퀀스를 포함하는 배열을 반환합니다. 이를 사용하여 배열 형식으로 제어된 시퀀스의 복사본을 가져옵니다.

예시

// cliext_multiset_to_array.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    c1.insert(L'a');
    c1.insert(L'b');
    c1.insert(L'c');

    // copy the container and modify it
    cli::array<wchar_t>^ a1 = c1.to_array();

    c1.insert(L'd');
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // display the earlier array copy
    for each (wchar_t elem in a1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();
    return (0);
    }
a b c d
a b c

multiset::upper_bound

지정된 키와 일치하는 범위의 끝을 찾습니다.

구문

iterator upper_bound(key_type key);

매개 변수

key
검색할 키 값입니다.

설명

멤버 함수는 제어되는 시퀀스에서 동일한 순서를 사용하는 마지막 요소를 X 결정합니다 key. 이러한 요소가 없거나 제어되는 시퀀스의 마지막 요소인 경우 X 반환 end()됩니다. 그렇지 않으면 첫 번째 요소를 넘어 X지정하는 반복기를 반환합니다. 이를 사용하여 지정된 키와 일치하는 제어된 시퀀스에서 현재 요소 시퀀스의 끝을 찾습니다.

예시

// cliext_multiset_upper_bound.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    c1.insert(L'a');
    c1.insert(L'b');
    c1.insert(L'c');

    // display initial contents " a b c"
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    System::Console::WriteLine("upper_bound(L'x')==end() = {0}",
        c1.upper_bound(L'x') == c1.end());

    System::Console::WriteLine("*upper_bound(L'a') = {0}",
        *c1.upper_bound(L'a'));
    System::Console::WriteLine("*upper_bound(L'b') = {0}",
        *c1.upper_bound(L'b'));
    return (0);
    }
a b c
upper_bound(L'x')==end() = True
*upper_bound(L'a') = b
*upper_bound(L'b') = c

multiset::value_comp

두 요소 값에 대한 순서 지정 대리자를 복사합니다.

구문

value_compare^ value_comp();

설명

멤버 함수는 제어되는 시퀀스를 정렬하는 데 사용되는 순서 지정 대리자를 반환합니다. 두 요소 값을 비교하는 데 사용합니다.

예시

// cliext_multiset_value_comp.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    Mymultiset::value_compare^ kcomp = c1.value_comp();

    System::Console::WriteLine("compare(L'a', L'a') = {0}",
        kcomp(L'a', L'a'));
    System::Console::WriteLine("compare(L'a', L'b') = {0}",
        kcomp(L'a', L'b'));
    System::Console::WriteLine("compare(L'b', L'a') = {0}",
        kcomp(L'b', L'a'));
    System::Console::WriteLine();
    return (0);
    }
compare(L'a', L'a') = False
compare(L'a', L'b') = True
compare(L'b', L'a') = False

multiset::value_compare

두 요소 값에 대한 순서 지정 대리자입니다.

구문

Microsoft::VisualC::StlClr::BinaryDelegate<generic_value, generic_value, bool>
    value_compare;

설명

형식은 해당 값 인수의 순서를 결정하는 대리자의 동의어입니다.

예시

// cliext_multiset_value_compare.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    Mymultiset::value_compare^ kcomp = c1.value_comp();

    System::Console::WriteLine("compare(L'a', L'a') = {0}",
        kcomp(L'a', L'a'));
    System::Console::WriteLine("compare(L'a', L'b') = {0}",
        kcomp(L'a', L'b'));
    System::Console::WriteLine("compare(L'b', L'a') = {0}",
        kcomp(L'b', L'a'));
    System::Console::WriteLine();
    return (0);
    }
compare(L'a', L'a') = False
compare(L'a', L'b') = True
compare(L'b', L'a') = False

multiset::value_type

요소의 형식입니다.

구문

typedef generic_value value_type;

설명

이 형식은 generic_value의 동의어입니다.

예시

// cliext_multiset_value_type.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    c1.insert(L'a');
    c1.insert(L'b');
    c1.insert(L'c');

    // display contents " a b c" using value_type
    for (Mymultiset::iterator it = c1.begin(); it != c1.end(); ++it)
        {   // store element in value_type object
        Mymultiset::value_type val = *it;

        System::Console::Write("{0} ", val);
        }
    System::Console::WriteLine();
    return (0);
    }
a b c

operator!= (multiset)

비교가 같지 않은 목록입니다.

구문

template<typename Key>
    bool operator!=(multiset<Key>% left,
        multiset<Key>% right);

매개 변수

left
비교할 왼쪽 컨테이너입니다.

right
비교할 오른쪽 컨테이너입니다.

설명

연산자 함수는 .를 반환합니다 !(left == right). 이를 사용하여 요소별로 두 다중 집합을 비교할 때와 right 같은 순서가 지정되지 않았는지 여부를 left 테스트합니다.

예시

// cliext_multiset_operator_ne.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    c1.insert(L'a');
    c1.insert(L'b');
    c1.insert(L'c');

    // display contents " a b c"
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // assign to a new container
    Mymultiset c2;
    c2.insert(L'a');
    c2.insert(L'b');
    c2.insert(L'd');

    // display contents " a b d"
    for each (wchar_t elem in c2)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    System::Console::WriteLine("[a b c] != [a b c] is {0}",
        c1 != c1);
    System::Console::WriteLine("[a b c] != [a b d] is {0}",
        c1 != c2);
    return (0);
    }
a b c
a b d
[a b c] != [a b c] is False
[a b c] != [a b d] is True

operator< (multiset) (STL/CLR)

비교보다 작게 나열합니다.

구문

template<typename Key>
    bool operator<(multiset<Key>% left,
        multiset<Key>% right);

매개 변수

left
비교할 왼쪽 컨테이너입니다.

right
비교할 오른쪽 컨테이너입니다.

설명

연산자 함수는 true인 가장 낮은 위치에 i 대해 !(right[i] < left[i]) true left[i] < right[i]를 반환합니다. 그 외의 경우 left->size() < right->size()를 반환합니다. 이를 사용하여 요소별로 두 다중 집합을 비교하기 전에 right 순서가 지정되는지 여부를 left 테스트합니다.

예시

// cliext_multiset_operator_lt.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    c1.insert(L'a');
    c1.insert(L'b');
    c1.insert(L'c');

    // display contents " a b c"
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // assign to a new container
    Mymultiset c2;
    c2.insert(L'a');
    c2.insert(L'b');
    c2.insert(L'd');

    // display contents " a b d"
    for each (wchar_t elem in c2)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    System::Console::WriteLine("[a b c] < [a b c] is {0}",
        c1 < c1);
    System::Console::WriteLine("[a b c] < [a b d] is {0}",
        c1 < c2);
    return (0);
    }
a b c
a b d
[a b c] < [a b c] is False
[a b c] < [a b d] is True

operator<= (multiset)

보다 작거나 같은 비교를 나열합니다.

구문

template<typename Key>
    bool operator<=(multiset<Key>% left,
        multiset<Key>% right);

매개 변수

left
비교할 왼쪽 컨테이너입니다.

right
비교할 오른쪽 컨테이너입니다.

설명

연산자 함수는 .를 반환합니다 !(right < left). 두 다중 집합이 요소별로 비교된 후 right 정렬되지 않는지 여부를 left 테스트하는 데 사용합니다.

예시

// cliext_multiset_operator_le.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    c1.insert(L'a');
    c1.insert(L'b');
    c1.insert(L'c');

    // display contents " a b c"
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // assign to a new container
    Mymultiset c2;
    c2.insert(L'a');
    c2.insert(L'b');
    c2.insert(L'd');

    // display contents " a b d"
    for each (wchar_t elem in c2)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    System::Console::WriteLine("[a b c] <= [a b c] is {0}",
        c1 <= c1);
    System::Console::WriteLine("[a b d] <= [a b c] is {0}",
        c2 <= c1);
    return (0);
    }
a b c
a b d
[a b c] <= [a b c] is True
[a b d] <= [a b c] is False

operator== (multiset)

같음 비교를 나열합니다.

구문

template<typename Key>
    bool operator==(multiset<Key>% left,
        multiset<Key>% right);

매개 변수

left
비교할 왼쪽 컨테이너입니다.

right
비교할 오른쪽 컨테이너입니다.

설명

연산자 함수는 시퀀스가 제어되고 left 길이가 같고 right 각 위치에 ileft[i] == right[i]대해 true를 반환합니다. 두 다중 집합이 요소별로 비교될 때와 right 동일한 순서가 지정되는지 여부를 left 테스트하는 데 사용합니다.

예시

// cliext_multiset_operator_eq.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    c1.insert(L'a');
    c1.insert(L'b');
    c1.insert(L'c');

    // display contents " a b c"
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // assign to a new container
    Mymultiset c2;
    c2.insert(L'a');
    c2.insert(L'b');
    c2.insert(L'd');

    // display contents " a b d"
    for each (wchar_t elem in c2)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    System::Console::WriteLine("[a b c] == [a b c] is {0}",
        c1 == c1);
    System::Console::WriteLine("[a b c] == [a b d] is {0}",
        c1 == c2);
    return (0);
    }
a b c
a b d
[a b c] == [a b c] is True
[a b c] == [a b d] is False

operator> (multiset)

비교보다 큰 목록을 표시합니다.

구문

template<typename Key>
    bool operator>(multiset<Key>% left,
        multiset<Key>% right);

매개 변수

left
비교할 왼쪽 컨테이너입니다.

right
비교할 오른쪽 컨테이너입니다.

설명

연산자 함수는 .를 반환합니다 right < left. 두 다중 집합이 요소별로 비교된 후 right 순서가 지정되는지 여부를 left 테스트하는 데 사용합니다.

예시

// cliext_multiset_operator_gt.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    c1.insert(L'a');
    c1.insert(L'b');
    c1.insert(L'c');

    // display contents " a b c"
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // assign to a new container
    Mymultiset c2;
    c2.insert(L'a');
    c2.insert(L'b');
    c2.insert(L'd');

    // display contents " a b d"
    for each (wchar_t elem in c2)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    System::Console::WriteLine("[a b c] > [a b c] is {0}",
        c1 > c1);
    System::Console::WriteLine("[a b d] > [a b c] is {0}",
        c2 > c1);
    return (0);
    }
a b c
a b d
[a b c] > [a b c] is False
[a b d] > [a b c] is True

operator>= (multiset)

보다 크거나 같은 비교를 나열합니다.

구문

template<typename Key>
    bool operator>=(multiset<Key>% left,
        multiset<Key>% right);

매개 변수

left
비교할 왼쪽 컨테이너입니다.

right
비교할 오른쪽 컨테이너입니다.

설명

연산자 함수는 .를 반환합니다 !(left < right). 두 다중 집합이 요소별로 비교될 때 이전에 right 순서가 지정되지 않았는지 여부를 left 테스트하는 데 사용합니다.

예제

// cliext_multiset_operator_ge.cpp
// compile with: /clr
#include <cliext/set>

typedef cliext::multiset<wchar_t> Mymultiset;
int main()
    {
    Mymultiset c1;
    c1.insert(L'a');
    c1.insert(L'b');
    c1.insert(L'c');

    // display contents " a b c"
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // assign to a new container
    Mymultiset c2;
    c2.insert(L'a');
    c2.insert(L'b');
    c2.insert(L'd');

    // display contents " a b d"
    for each (wchar_t elem in c2)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    System::Console::WriteLine("[a b c] >= [a b c] is {0}",
        c1 >= c1);
    System::Console::WriteLine("[a b c] >= [a b d] is {0}",
        c1 >= c2);
    return (0);
    }
a b c
a b d
[a b c] >= [a b c] is True
[a b c] >= [a b d] is False