make_collection (STL/CLR)

Fare range_adapter da una coppia di iteratore.

template<typename Iter>
    range_adapter<Iter> make_collection(Iter first, Iter last);

Parametri

  • ITER
    Il tipo degli iteratori di cui è stato eseguito il wrapping.

  • innanzitutto
    Primo iteratore di cui eseguire il wrapping.

  • last
    Come iteratore di cui eseguire il wrapping.

Note

La funzione di modello restituisce gcnew range_adapter<Iter>(first,last).Utilizzarla per costruire un oggetto di range_adapter<Iter> da una coppia degli iteratori.

Esempio

// cliext_make_collection.cpp 
// compile with: /clr 
#include <cliext/adapter> 
#include <cliext/deque> 
 
typedef cliext::deque<wchar_t> Mycont; 
typedef cliext::range_adapter<Mycont::iterator> Myrange; 
int main() 
    { 
    cliext::deque<wchar_t> d1; 
    d1.push_back(L'a'); 
    d1.push_back(L'b'); 
    d1.push_back(L'c'); 
 
// display contents " a b c" 
    for each (wchar_t elem in d1) 
        System::Console::Write(" {0}", elem); 
    System::Console::WriteLine(); 
 
    System::Collections::ICollection^ p1 = 
        cliext::make_collection(d1.begin(), d1.end()); 
    System::Console::WriteLine("Count = {0}", p1->Count); 
    System::Console::WriteLine("IsSynchronized = {0}", 
        p1->IsSynchronized); 
    System::Console::WriteLine("SyncRoot not nullptr = {0}", 
        p1->SyncRoot != nullptr); 
 
// copy the sequence 
    cli::array<System::Object^>^ a1 = gcnew cli::array<System::Object^>(5); 
 
    a1[0] = L'|'; 
    p1->CopyTo(a1, 1); 
    a1[4] = L'|'; 
    for each (wchar_t elem in a1) 
        System::Console::Write(" {0}", elem); 
    System::Console::WriteLine(); 
 
    return (0); 
    } 
 
  

Requisiti

intestazione: <cliext/adattatore>

Cliext diSpazio dei nomi:

Vedere anche

Riferimenti

range_adapter (STL/CLR)