Поделиться через


range_adapter::range_adapter (STL/CLR)

Constructs an adapter object.

    range_adapter();
    range_adapter(range_adapter<Iter>% right);
    range_adapter(range_adapter<Iter>^ right);
    range_adapter(Iter first, Iter last);

Parameters

  • first
    First iterator to wrap.

  • last
    Second iterator to wrap.

  • right
    Object to copy.

Remarks

The constructor:

range_adapter();

initializes the stored iterator pair with default constructed iterators.

The constructor:

range_adapter(range_adapter<Iter>% right);

initializes the stored iterator pair by copying the pair stored in right.

The constructor:

range_adapter(range_adapter<Iter>^ right);

initializes the stored iterator pair by copying the pair stored in *right.

The constructor:

range_adapter(Iter^ first, last);

initializes the stored iterator pair with first and last.

Example

// cliext_range_adapter_construct.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'); 
 
// construct an empty adapter 
    Myrange c1; 
 
// construct with an iterator pair 
    Myrange c2(d1.begin(), d1.end()); 
    for each (wchar_t elem in c2) 
        System::Console::Write(" {0}", elem); 
    System::Console::WriteLine(); 
 
// construct by copying another adapter 
    Myrange c3(c2); 
    for each (wchar_t elem in c3) 
        System::Console::Write(" {0}", elem); 
    System::Console::WriteLine(); 
 
// construct by copying an adapter handle 
    Myrange c4(%c3); 
    for each (wchar_t elem in c4) 
        System::Console::Write(" {0}", elem); 
    System::Console::WriteLine(); 
 
    return (0); 
    } 
 
 a b c
 a b c
 a b c

Requirements

Header: <cliext/adapter>

Namespace: cliext

See Also

Reference

range_adapter (STL/CLR)

range_adapter::operator= (STL/CLR)