<cliext/adapter> (STL/CLR)

STL/CLR 헤더 <cliext/adapter> 는 두 개의 클래스 템플릿(collection_adapter 및 )과 range_adapter함수 템플릿 make_collection을 지정합니다.

구문

#include <cliext/adapter>

요구 사항

헤더:<cliext/adapter>

네임스페이스:cliext

선언

클래스 설명
collection_adapter BCL(기본 클래스 라이브러리) 컬렉션을 범위로 래핑합니다.
range_adapter 범위를 BCL 컬렉션으로 래핑합니다.
함수 설명
make_collection 반복기 쌍을 사용하여 범위 어댑터를 만듭니다.

멤버

collection_adapter

STL/CLR 컨테이너로 사용할 .NET 컬렉션을 래핑합니다. A collection_adapter 는 간단한 STL/CLR 컨테이너 개체를 설명하는 템플릿 클래스입니다. BCL(기본 클래스 라이브러리) 인터페이스를 래핑하고 제어되는 시퀀스를 조작하는 데 사용하는 반복기 쌍을 반환합니다.

구문

template<typename Coll>
    ref class collection_adapter;

template<>
    ref class collection_adapter<
        System::Collections::ICollection>;
template<>
    ref class collection_adapter<
        System::Collections::IEnumerable>;
template<>
    ref class collection_adapter<
        System::Collections::IList>;
template<>
    ref class collection_adapter<
        System::Collections::IDictionary>;
template<typename Value>
    ref class collection_adapter<
        System::Collections::Generic::ICollection<Value>>;
template<typename Value>
    ref class collection_adapter<
        System::Collections::Generic::IEnumerable<Value>>;
template<typename Value>
    ref class collection_adapter<
        System::Collections::Generic::IList<Value>>;
template<typename Key,
    typename Value>
    ref class collection_adapter<
        System::Collections::Generic::IDictionary<Key, Value>>;

매개 변수

Coll
래핑된 컬렉션의 형식입니다.

특수화

특수화 설명
IEnumerable 요소를 통해 시퀀스합니다.
ICollection 요소 그룹을 유지 관리합니다.
IList 정렬된 요소 그룹을 유지 관리합니다.
IDictionary {key, value} 쌍 집합을 유지 관리합니다.
IEnumerable<Value> 형식화된 요소를 통한 시퀀스입니다.
ICollection<Value> 형식화된 요소 그룹을 유지 관리합니다.
IList<Value> 정렬된 형식화된 요소 그룹을 유지 관리합니다.
IDictionary<Value> 형식화된 {key, value} 쌍 집합을 유지 관리합니다.

멤버

형식 정의 설명
collection_adapter::difference_type 두 요소 사이의 부호가 있는 거리의 형식입니다.
collection_adapter::iterator 제어되는 시퀀스에 대한 반복기의 형식입니다.
collection_adapter::key_type 사전 키의 형식입니다.
collection_adapter::mapped_type 사전 값의 형식입니다.
collection_adapter::reference 요소에 대한 참조의 형식입니다.
collection_adapter::size_type 두 요소 사이의 부호가 있는 거리의 형식입니다.
collection_adapter::value_type 요소의 형식입니다.
멤버 함수 설명
collection_adapter::base 래핑된 BCL 인터페이스를 지정합니다.
collection_adapter::begin 제어되는 시퀀스의 시작을 지정합니다.
collection_adapter::collection_adapter 어댑터 개체를 생성합니다.
collection_adapter::end 제어되는 시퀀스의 끝을 지정합니다.
collection_adapter::size 요소 수를 계산합니다.
collection_adapter::swap 두 컨테이너의 내용을 바꿉니다.
연산자 설명
collection_adapter::operator= 저장된 BCL 핸들을 바꿉니다.

설명

이 템플릿 클래스를 사용하여 BCL 컨테이너를 STL/CLR 컨테이너로 조작합니다. BCL collection_adapter 인터페이스에 대한 핸들을 저장합니다. 이 인터페이스는 요소 시퀀스를 제어합니다. 개체 Xcollection_adapter 입력 반복기 쌍을 X.begin() 반환하고 X.end() 요소를 순서대로 방문하는 데 사용합니다. 또한 일부 특수화를 사용하여 X.size() 제어되는 시퀀스의 길이를 결정할 수 있습니다.

collection_adapter::base

래핑된 BCL 인터페이스를 지정합니다.

구문

Coll^ base();

설명

멤버 함수는 저장된 BCL 인터페이스 핸들을 반환합니다.

예시

// cliext_collection_adapter_base.cpp
// compile with: /clr
#include <cliext/adapter>
#include <cliext/deque>

typedef cliext::collection_adapter<
    System::Collections::ICollection> Mycoll;
int main()
    {
    cliext::deque<wchar_t> d6x(6, L'x');
    Mycoll c1(%d6x);

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

    System::Console::WriteLine("base() same = {0}", c1.base() == %c1);
    return (0);
    }
x x x x x x
base() same = True

collection_adapter::begin

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

구문

iterator begin();

설명

멤버 함수는 제어되는 시퀀스의 첫 번째 요소를 지정하거나 빈 시퀀스의 끝 바로 너머를 지정하는 입력 반복기를 반환합니다.

예시

// cliext_collection_adapter_begin.cpp
// compile with: /clr
#include <cliext/adapter>
#include <cliext/deque>

typedef cliext::collection_adapter<
    System::Collections::ICollection> Mycoll;
int main()
{
    cliext::deque<wchar_t> d1;
    d1.push_back(L'a');
    d1.push_back(L'b');
    d1.push_back(L'c');
    Mycoll c1(%d1);

    // 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
    Mycoll::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

collection_adapter::collection_adapter

어댑터 개체를 생성합니다.

구문

collection_adapter();
collection_adapter(collection_adapter<Coll>% right);
collection_adapter(collection_adapter<Coll>^ right);
collection_adapter(Coll^ collection);

매개 변수

collection
래핑할 BCL 핸들입니다.

right
복사할 개체입니다.

설명

생성자:

collection_adapter();

을 사용하여 저장된 핸들을 초기화합니다 nullptr.

생성자:

collection_adapter(collection_adapter<Coll>% right);

을 사용하여 저장된 핸들을 초기화합니다 right.base().

생성자:

collection_adapter(collection_adapter<Coll>^ right);

을 사용하여 저장된 핸들을 초기화합니다 right->base().

생성자:

collection_adapter(Coll^ collection);

을 사용하여 저장된 핸들을 초기화합니다 collection.

예시

// cliext_collection_adapter_construct.cpp
// compile with: /clr
#include <cliext/adapter>
#include <cliext/deque>

typedef cliext::collection_adapter<
    System::Collections::ICollection> Mycoll;
int main()
{
    cliext::deque<wchar_t> d6x(6, L'x');

    // construct an empty container
    Mycoll c1;
    System::Console::WriteLine("base() null = {0}", c1.base() == nullptr);

    // construct with a handle
    Mycoll c2(%d6x);
    for each (wchar_t elem in c2)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // construct by copying another container
    Mycoll c3(c2);
    for each (wchar_t elem in c3)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // construct by copying a container handle
    Mycoll c4(%c3);
    for each (wchar_t elem in c4)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    return (0);
}
base() null = True
x x x x x x
x x x x x x
x x x x x x

collection_adapter::difference_type

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

구문

typedef int difference_type;

설명

형식은 서명된 요소 수를 설명합니다.

예시

// cliext_collection_adapter_difference_type.cpp
// compile with: /clr
#include <cliext/adapter>
#include <cliext/deque>

typedef cliext::collection_adapter<
    System::Collections::ICollection> Mycoll;
int main()
{
    cliext::deque<wchar_t> d1;
    d1.push_back(L'a');
    d1.push_back(L'b');
    d1.push_back(L'c');
    Mycoll c1(%d1);

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

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

collection_adapter::end

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

구문

iterator end();

설명

멤버 함수는 제어되는 시퀀스의 끝 바로 다음을 가리키는 입력 반복기를 반환합니다.

예시

// cliext_collection_adapter_end.cpp
// compile with: /clr
#include <cliext/adapter>
#include <cliext/deque>

typedef cliext::collection_adapter<
    System::Collections::ICollection> Mycoll;
int main()
{
    cliext::deque<wchar_t> d1;
    d1.push_back(L'a');
    d1.push_back(L'b');
    d1.push_back(L'c');
    Mycoll c1(%d1);

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

collection_adapter::iterator

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

구문

typedef T1 iterator;

설명

형식은 제어되는 시퀀스에 대한 입력 반복기로 사용할 수 있는 지정되지 않은 형식 T1 의 개체를 설명합니다.

예시

// cliext_collection_adapter_iterator.cpp
// compile with: /clr
#include <cliext/adapter>
#include <cliext/deque>

typedef cliext::collection_adapter<
    System::Collections::ICollection> Mycoll;
int main()
{
    cliext::deque<wchar_t> d1;
    d1.push_back(L'a');
    d1.push_back(L'b');
    d1.push_back(L'c');
    Mycoll c1(%d1);

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

collection_adapter::key_type

사전 키의 형식입니다.

구문

typedef Key key_type;

설명

형식은 특수화 IDictionary 에서 템플릿 매개 변수Key의 동의어이거나 IDictionary<Value>정의되지 않습니다.

예시

// cliext_collection_adapter_key_type.cpp
// compile with: /clr
#include <cliext/adapter>
#include <cliext/map>

typedef cliext::map<wchar_t, int> Mymap;
typedef cliext::collection_adapter<
    System::Collections::Generic::IDictionary<wchar_t, int>> Mycoll;
typedef System::Collections::Generic::KeyValuePair<wchar_t,int> Mypair;
int main()
{
    Mymap d1;
    d1.insert(Mymap::make_value(L'a', 1));
    d1.insert(Mymap::make_value(L'b', 2));
    d1.insert(Mymap::make_value(L'c', 3));
    Mycoll c1(%d1);

    // display contents "[a 1] [b 2] [c 3] "
    for each (Mypair elem in c1)
    {
        Mycoll::key_type key = elem.Key;
        Mycoll::mapped_type value = elem.Value;
        System::Console::Write("[{0} {1}] ", key, value);
    }
    System::Console::WriteLine();
    return (0);
}
[a 1] [b 2] [c 3]

collection_adapter::mapped_type

사전 값의 형식입니다.

구문

typedef Value mapped_type;

설명

형식은 특수화 IDictionary 에서 템플릿 매개 변수Value의 동의어이거나 IDictionary<Value>정의되지 않습니다.

예시

// cliext_collection_adapter_mapped_type.cpp
// compile with: /clr
#include <cliext/adapter>
#include <cliext/map>

typedef cliext::map<wchar_t, int> Mymap;
typedef cliext::collection_adapter<
    System::Collections::Generic::IDictionary<wchar_t, int>> Mycoll;
typedef System::Collections::Generic::KeyValuePair<wchar_t,int> Mypair;
int main()
{
    Mymap d1;
    d1.insert(Mymap::make_value(L'a', 1));
    d1.insert(Mymap::make_value(L'b', 2));
    d1.insert(Mymap::make_value(L'c', 3));
    Mycoll c1(%d1);

    // display contents "[a 1] [b 2] [c 3] "
    for each (Mypair elem in c1)
    {
        Mycoll::key_type key = elem.Key;
        Mycoll::mapped_type value = elem.Value;
        System::Console::Write("[{0} {1}] ", key, value);
    }
    System::Console::WriteLine();
    return (0);
}
[a 1] [b 2] [c 3]

collection_adapter::operator=

저장된 BCL 핸들을 바꿉니다.

구문

collection_adapter<Coll>% operator=(collection_adapter<Coll>% right);

매개 변수

right
복사할 어댑터입니다.

설명

멤버 연산자는 개체에 복사한 다음 반환합니다 right*this. 저장된 BCL 핸들을 저장된 BCL 핸들 right의 복사본으로 바꾸는 데 사용합니다.

예시

// cliext_collection_adapter_operator_as.cpp
// compile with: /clr
#include <cliext/adapter>
#include <cliext/deque>

typedef cliext::collection_adapter<
    System::Collections::ICollection> Mycoll;
int main()
{
    cliext::deque<wchar_t> d1;
    d1.push_back(L'a');
    d1.push_back(L'b');
    d1.push_back(L'c');
    Mycoll c1(%d1);

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

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

collection_adapter::reference

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

구문

typedef value_type% reference;

설명

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

예시

// cliext_collection_adapter_reference.cpp
// compile with: /clr
#include <cliext/adapter>
#include <cliext/deque>

typedef cliext::collection_adapter<
    System::Collections::ICollection> Mycoll;
int main()
    {
    cliext::deque<wchar_t> d1;
    d1.push_back(L'a');
    d1.push_back(L'b');
    d1.push_back(L'c');
    Mycoll c1(%d1);

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

collection_adapter::size

요소 수를 계산합니다.

구문

size_type size();

설명

멤버 함수는 제어되는 시퀀스의 길이를 반환합니다. 특수화 IEnumerableIEnumerable<Value>정의되어 있지 않습니다.

예시

// cliext_collection_adapter_size.cpp
// compile with: /clr
#include <cliext/adapter>
#include <cliext/deque>

typedef cliext::collection_adapter<
    System::Collections::ICollection> Mycoll;
int main()
{
    cliext::deque<wchar_t> d6x(6, L'x');
    Mycoll c1(%d6x);

    // display initial contents "x x x x x x "
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();
    System::Console::WriteLine("size() = {0}", c1.size());
    return (0);
}
x x x x x x
size() = 6

collection_adapter::size_type

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

구문

typedef int size_type;

설명

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

예시

// cliext_collection_adapter_size_type.cpp
// compile with: /clr
#include <cliext/adapter>
#include <cliext/deque>

typedef cliext::collection_adapter<
    System::Collections::ICollection> Mycoll;
int main()
{
    cliext::deque<wchar_t> d6x(6, L'x');
    Mycoll c1(%d6x);

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

    Mycoll::size_type size = c1.size();
    System::Console::WriteLine("size() = {0}", size);
    return (0);
}
x x x x x x
size() = 6

collection_adapter::swap

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

구문

void swap(collection_adapter<Coll>% right);

매개 변수

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

설명

멤버 함수는 저장된 BCL 핸들을 간에 *thisright교환합니다.

예시

// cliext_collection_adapter_swap.cpp
// compile with: /clr
#include <cliext/adapter>
#include <cliext/deque>

typedef cliext::collection_adapter<
    System::Collections::ICollection> Mycoll;
int main()
{
    cliext::deque<wchar_t> d1;
    d1.push_back(L'a');
    d1.push_back(L'b');
    d1.push_back(L'c');
    Mycoll c1(%d1);

    // 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
    cliext::deque<wchar_t> d2(5, L'x');
    Mycoll c2(%d2);
    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
x x x x x
x x x x x
a b c

collection_adapter::value_type

요소의 형식입니다.

구문

typedef Value value_type;

설명

형식은 특수화에 있는 경우 템플릿 매개 변수 Value의 동의어이고, 그렇지 않으면 의 동의어 System::Object^입니다.

예시

// cliext_collection_adapter_value_type.cpp
// compile with: /clr
#include <cliext/adapter>
#include <cliext/deque>

typedef cliext::collection_adapter<
    System::Collections::ICollection> Mycoll;
int main()
{
    cliext::deque<wchar_t> d1;
    d1.push_back(L'a');
    d1.push_back(L'b');
    d1.push_back(L'c');
    Mycoll c1(%d1);

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

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

make_collection(STL/CLR)

range_adapter 반복기 쌍에서 만듭니다.

구문

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

매개 변수

Iter
래핑된 반복기의 형식입니다.

first
래핑할 첫 번째 반복기입니다.

last
래핑할 두 번째 반복기입니다.

설명

함수 템플릿은 .를 반환합니다 gcnew range_adapter<Iter>(first, last). 반복기 쌍에서 개체를 range_adapter<Iter> 생성하는 데 사용합니다.

예시

// 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);
}
a b c
Count = 3
IsSynchronized = False
SyncRoot not nullptr = True
| a b c |

range_adapter(STL/CLR)

여러 BCL(기본 클래스 라이브러리) 인터페이스를 구현하는 데 사용되는 반복기 쌍을 래핑하는 템플릿 클래스입니다. range_adapter 사용하여 BCL 컬렉션인 것처럼 STL/CLR 범위를 조작합니다.

구문

template<typename Iter>
    ref class range_adapter
        :   public
        System::Collections::IEnumerable,
        System::Collections::ICollection,
        System::Collections::Generic::IEnumerable<Value>,
        System::Collections::Generic::ICollection<Value>
    { ..... };

매개 변수

Iter
래핑된 반복기와 연결된 형식입니다.

멤버

멤버 함수 설명
range_adapter::range_adapter 어댑터 개체를 생성합니다.
연산자 설명
range_adapter::operator= 저장된 반복기 쌍을 바꿉니다.

인터페이스

인터페이스 설명
IEnumerable 컬렉션의 요소를 반복합니다.
ICollection 요소 그룹을 유지 관리합니다.
IEnumerable<T> 컬렉션에서 형식화된 요소를 반복합니다.
ICollection<T> 형식화된 요소 그룹을 유지 관리합니다.

설명

range_adapter 반복기 쌍을 저장하여 요소 시퀀스를 구분합니다. 개체는 요소를 순서대로 반복할 수 있는 4개의 BCL 인터페이스를 구현합니다. 이 템플릿 클래스를 사용하여 BCL 컨테이너와 마찬가지로 STL/CLR 범위를 조작합니다.

range_adapter::operator=

저장된 반복기 쌍을 바꿉니다.

구문

range_adapter<Iter>% operator=(range_adapter<Iter>% right);

매개 변수

right
복사할 어댑터입니다.

설명

멤버 연산자는 개체에 복사한 다음 반환합니다 right*this. 저장된 반복기 쌍을 저장된 반복기 쌍 right의 복사본으로 바꾸는 데 사용합니다.

예시

// cliext_range_adapter_operator_as.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');
    Myrange c1(d1.begin(), d1.end());

    // 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
    Myrange c2;
    c2 = c1;
    for each (wchar_t elem in c2)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();
    return (0);
}
a b c
a b c

range_adapter::range_adapter

어댑터 개체를 생성합니다.

구문

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

매개 변수

first
래핑할 첫 번째 반복기입니다.

last
래핑할 두 번째 반복기입니다.

right
복사할 개체입니다.

설명

생성자:

range_adapter();

는 기본 생성된 반복기를 사용하여 저장된 반복기 쌍을 초기화합니다.

생성자:

range_adapter(range_adapter<Iter>% right);

에 저장된 쌍을 복사하여 저장된 반복기 쌍을 초기화합니다 right.

생성자:

range_adapter(range_adapter<Iter>^ right);

에 저장된 쌍을 복사하여 저장된 반복기 쌍을 초기화합니다 *right.

생성자:

range_adapter(Iter^ first, last);

와 함께 저장된 반복기 쌍을 first 초기화합니다 last.

예제

// 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