共用方式為


multiset::multiset (STL/CLR)

建構容器物件。

    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);

參數

  • 第一個
    若要插入範圍的開頭。

  • last
    若要插入範圍的結尾。

  • pred
    排序受控制序列的述詞。

  • right
    物件,則要插入的範圍。

備註

建構函式:

multiset();

以預設順序的述詞初始化任何項目時,受控制的序列key_compare()。您可以用它來指定空的初始受控制的序列,以預設順序的述詞。

建構函式:

explicit multiset(key_compare^ pred);

初始化任何項目時,排序的述詞與受控制的序列pred。您可以用它來指定空的初始受控制的序列,以指定順序的述詞。

建構函式:

multiset(multiset<Key>% right);

初始化受控制序列的序列[right.multiset::begin (STL/CLR)(), right.multiset::end (STL/CLR)()),以預設順序的述詞。您會用它來指定初始的受控制的序列是一份由多重集的物件控制的序列, right,以預設順序的述詞。

建構函式:

multiset(multiset<Key>^ right);

初始化受控制序列的序列[right->multiset::begin (STL/CLR)(), right->multiset::end (STL/CLR)()),以預設順序的述詞。您會用它來指定初始的受控制的序列是一份由多重集的物件控制的序列, right,以預設順序的述詞。

建構函式:

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); 
    } 
 
  

需求

標頭: < cliext/設定 >

Namespace: cliext

請參閱

參考

multiset (STL/CLR)

multiset::generic_container (STL/CLR)

multiset::operator= (STL/CLR)