list(STL/CLR)

템플릿 클래스는 양방향 액세스 권한이 있는 요소의 다양한 길이 시퀀스를 제어하는 개체를 설명합니다. 컨테이너 list 를 사용하여 요소 시퀀스를 노드의 양방향 연결된 목록으로 관리하며 각 요소는 저장됩니다.

아래 GValue 설명에서 후자가 ref 형식이 아니면 Value동일합니다. 이 경우 값입니다Value^.

구문

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

매개 변수


제어되는 시퀀스의 요소 형식입니다.

요구 사항

헤더:<cliext/list>

네임스페이스: cliext

선언

형식 정의 설명
list::const_iterator(STL/CLR) 제어되는 시퀀스에 대한 상수 반복기의 형식입니다.
list::const_reference(STL/CLR) 요소에 대한 상수 참조의 형식입니다.
list::const_reverse_iterator(STL/CLR) 제어되는 시퀀스에 대한 상수 역방향 반복기의 형식입니다.
list::difference_type(STL/CLR) 두 요소 사이의 부호가 있는 거리의 형식입니다.
list::generic_container(STL/CLR) 컨테이너에 대한 제네릭 인터페이스의 형식입니다.
list::generic_iterator(STL/CLR) 컨테이너의 제네릭 인터페이스에 대한 반복기의 형식입니다.
list::generic_reverse_iterator(STL/CLR) 컨테이너의 제네릭 인터페이스에 대한 역방향 반복기의 형식입니다.
list::generic_value(STL/CLR) 컨테이너의 제네릭 인터페이스에 대한 요소의 형식입니다.
list::iterator(STL/CLR) 제어되는 시퀀스에 대한 반복기의 형식입니다.
list::reference(STL/CLR) 요소에 대한 참조의 형식입니다.
list::reverse_iterator(STL/CLR) 제어되는 시퀀스에 대한 반대 반복기의 형식입니다.
list::size_type(STL/CLR) 두 요소 사이의 부호가 있는 거리의 형식입니다.
list::value_type(STL/CLR) 요소의 형식입니다.
멤버 함수 설명
list::assign(STL/CLR) 모든 요소를 바꿉니다.
list::back(STL/CLR) 마지막 요소에 액세스합니다.
list::begin(STL/CLR) 제어되는 시퀀스의 시작을 지정합니다.
list::clear(STL/CLR) 모든 요소를 제거합니다.
list::empty(STL/CLR) 요소가 있는지 여부를 테스트합니다.
list::end(STL/CLR) 제어되는 시퀀스의 끝을 지정합니다.
list::erase(STL/CLR) 지정된 위치에 있는 요소를 제거합니다.
list::front(STL/CLR) 첫 번째 요소에 액세스합니다.
list::insert(STL/CLR) 지정된 위치에 요소를 추가합니다.
list::list(STL/CLR) 컨테이너 개체를 만듭니다.
list::merge(STL/CLR) 두 개의 순서가 지정된 제어 시퀀스를 병합합니다.
list::pop_back(STL/CLR) 마지막 요소를 제거합니다.
list::pop_front(STL/CLR) 첫 번째 요소를 제거합니다.
list::push_back(STL/CLR) 새 마지막 요소를 추가합니다.
list::push_front(STL/CLR) 새 첫 번째 요소를 추가합니다.
list::rbegin(STL/CLR) 제어되는 역방향 시퀀스의 시작을 지정합니다.
list::remove(STL/CLR) 지정된 값을 가진 요소를 제거합니다.
list::remove_if(STL/CLR) 지정된 테스트를 통과하는 요소를 제거합니다.
list::rend(STL/CLR) 제어되는 역방향 시퀀스의 끝을 지정합니다.
list::resize(STL/CLR) 요소 수를 변경합니다.
list::reverse(STL/CLR) 제어된 시퀀스를 반대로 바뀝니다.
list::size(STL/CLR) 요소 수를 계산합니다.
list::sort(STL/CLR) 제어된 시퀀스를 정렬합니다.
list::splice(STL/CLR) 노드 간의 연결을 다시 붙입니다.
list::swap(STL/CLR) 두 컨테이너의 내용을 바꿉니다.
list::to_array(STL/CLR) 제어된 시퀀스를 새 배열에 복사합니다.
list::unique(STL/CLR) 지정된 테스트를 통과하는 인접 요소를 제거합니다.
속성 설명
list::back_item(STL/CLR) 마지막 요소에 액세스합니다.
list::front_item(STL/CLR) 첫 번째 요소에 액세스합니다.
연산자 설명
list::operator=(STL/CLR) 제어되는 시퀀스를 바꿉니다.
operator!= (list)(STL/CLR) 개체가 다른 list 개체와 list 같지 않은지 여부를 확인합니다.
연산자< (list)(STL/CLR) 개체가 다른 list 개체보다 작은지 여부를 list 확인합니다.
operator<= (list)(STL/CLR) 개체가 다른 list 개체보다 작거나 같은지 여부를 list 확인합니다.
operator== (list)(STL/CLR) 개체가 다른 list 개체와 list 같은지 여부를 확인합니다.
연산자> (list)(STL/CLR) 개체가 다른 list 개체보다 큰지 여부를 list 확인합니다.
operator>= (list)(STL/CLR) 개체가 다른 list 개체보다 크거나 같은지 여부를 list 확인합니다.

인터페이스

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

설명

개체는 양방향 링크 목록에서 개별 노드로 제어하는 시퀀스에 대한 스토리지를 할당하고 해제합니다. 한 노드의 내용을 다른 노드에 복사하지 않고 노드 간 링크를 변경하여 요소를 다시 정렬합니다. 즉, 요소를 다시 기본 방해하지 않고 요소를 자유롭게 삽입하고 제거할 수 있습니다. 따라서 목록은 STL/CLR(템플릿 클래스 큐) 또는 템플릿 클래스 스택(STL/CLR)의 기본 컨테이너에 적합한 후보입니다.

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

임의 액세스 반복기가 필요한 숫자 위치를 지정하면 목록 요소를 직접 참조할 수 없습니다. 따라서 목록은 템플릿 클래스 priority_queue(STL/CLR)의 기본 컨테이너로 사용할 수 없습니다.

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

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

멤버

list::assign(STL/CLR)

모든 요소를 바꿉니다.

구문

void assign(size_type count, value_type val);
template<typename InIt>
    void assign(InIt first, InIt last);
void assign(System::Collections::Generic::IEnumerable<Value>^ right);

매개 변수

count
삽입할 요소의 수입니다.

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

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

right
삽입할 열거형입니다.

val
삽입할 요소의 값입니다.

설명

첫 번째 멤버 함수는 제어된 시퀀스를 값 valcount 요소 반복으로 바꿉니다. 컨테이너를 모두 동일한 값을 갖는 요소로 채우는 데 사용합니다.

정수 형식인 경우 InIt 두 번째 멤버 함수는 .와 동일하게 assign((size_type)first, (value_type)last)동작합니다. 그렇지 않으면 제어되는 시퀀스를 시퀀스 [first, last)로 바꿉니다. 제어되는 시퀀스를 다른 시퀀스로 복사하는 데 사용합니다.

세 번째 멤버 함수는 제어되는 시퀀스를 열거자 권한으로 지정된 시퀀스로 바꿉니다. 제어되는 시퀀스를 열거자가 설명하는 시퀀스의 복사본으로 만드는 데 사용합니다.

예시

// cliext_list_assign.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(L'c');

    // assign a repetition of values
    cliext::list<wchar_t> c2;
    c2.assign(6, L'x');
    for each (wchar_t elem in c2)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

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

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

list::back(STL/CLR)

마지막 요소에 액세스합니다.

구문

reference back();

설명

멤버 함수는 제어되는 시퀀스의 마지막 요소에 대한 참조를 반환하며, 이 요소는 비어 있어야 합니다. 마지막 요소에 액세스하는 데 사용합니다.이 요소는 존재하는 것을 알고 있을 때 사용합니다.

예시

// cliext_list_back.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(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 item
    System::Console::WriteLine("back() = {0}", c1.back());

    // alter last item and reinspect
    c1.back() = L'x';
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();
    return (0);
    }
a b c
back() = c
a b x

list::back_item(STL/CLR)

마지막 요소에 액세스합니다.

구문

property value_type back_item;

설명

이 속성은 제어되는 시퀀스의 마지막 요소에 액세스합니다. 이 요소는 비어 있어야 합니다. 마지막 요소가 있다는 것을 알면 이 요소를 사용하여 마지막 요소를 읽거나 씁니다.

예시

// cliext_list_back_item.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(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 item
    System::Console::WriteLine("back_item = {0}", c1.back_item);

    // alter last item and reinspect
    c1.back_item = L'x';
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();
    return (0);
    }
a b c
back_item = c
a b x

list::begin(STL/CLR)

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

구문

iterator begin();

설명

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

예시

// cliext_list_begin.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(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
    cliext::list<wchar_t>::iterator it = c1.begin();
    System::Console::WriteLine("*begin() = {0}", *it);
    System::Console::WriteLine("*++begin() = {0}", *++it);

    // alter first two items and reinspect
    *--it = L'x';
    *++it = L'y';
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();
    return (0);
    }
a b c
*begin() = a
*++begin() = b
x y c

list::clear(STL/CLR)

모든 요소를 제거합니다.

구문

void clear();

설명

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

예시

// cliext_list_clear.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(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.push_back(L'a');
    c1.push_back(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

list::const_iterator(STL/CLR)

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

구문

typedef T2 const_iterator;

설명

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

예시

// cliext_list_const_iterator.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(L'c');

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

list::const_reference(STL/CLR)

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

구문

typedef value_type% const_reference;

설명

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

예시

// cliext_list_const_reference.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(L'c');

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

list::const_reverse_iterator(STL/CLR)

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

구문

typedef T4 const_reverse_iterator;

설명

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

예시

// cliext_list_const_reverse_iterator.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(L'c');

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

list::difference_type(STL/CLR)

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

구문

typedef int difference_type;

설명

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

예시

// cliext_list_difference_type.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(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
    cliext::list<wchar_t>::difference_type diff = 0;
    for (cliext::list<wchar_t>::iterator it = c1.begin();
        it != c1.end(); ++it) ++diff;
    System::Console::WriteLine("end()-begin() = {0}", diff);

    // compute negative difference
    diff = 0;
    for (cliext::list<wchar_t>::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

list::empty(STL/CLR)

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

구문

bool empty();

설명

멤버 함수는 빈 제어되는 시퀀스에 대해 true를 반환합니다. list::size(STL/CLR)() == 0와 동일합니다. 목록을 사용하여 목록이 비어 있는지 여부를 테스트합니다.

예시

// cliext_list_empty.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(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

list::end(STL/CLR)

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

구문

iterator end();

설명

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

예시

// cliext_list_end.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(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
    cliext::list<wchar_t>::iterator it = c1.end();
    --it;
    System::Console::WriteLine("*-- --end() = {0}", *--it);
    System::Console::WriteLine("*--end() = {0}", *++it);

    // alter first two items and reinspect
    *--it = L'x';
    *++it = L'y';
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();
    return (0);
    }
a b c
*-- --end() = b
*--end() = c
a x y

list::erase(STL/CLR)

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

구문

iterator erase(iterator where);
iterator erase(iterator first, iterator last);

매개 변수

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

last
지울 범위의 끝입니다.

where
지울 요소입니다.

설명

첫 번째 멤버 함수는 위치가 가리키는 제어되는 시퀀스의 요소를 제거합니다. 단일 요소를 제거하는 데 사용합니다.

두 번째 멤버 함수는 [first, last]의 범위에서 제어되는 시퀀스의 요소를 제거합니다. 0개 이상의 연속 요소를 제거하는 데 사용합니다.

두 멤버 함수는 제거된 요소 외에 첫 번째 요소를 다시 지정하는 반복기를 반환하고기본 이러한 요소가 없으면 list::end(STL/CLR)()를 반환합니다.

요소를 지우는 경우 요소 복사본 수는 지우기 끝과 시퀀스의 가까운 끝 사이의 요소 수에서 선형입니다. (시퀀스의 양쪽 끝에서 하나 이상의 요소를 지우는 경우 요소 복사본이 발생하지 않습니다.)

예시

// cliext_list_erase.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(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.push_back(L'd');
    c1.push_back(L'e');
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // erase all but end
    cliext::list<wchar_t>::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

list::front(STL/CLR)

첫 번째 요소에 액세스합니다.

구문

reference front();

설명

멤버 함수는 제어되는 시퀀스의 첫 번째 요소에 대한 참조를 반환하며, 이 요소는 비어 있어야 합니다. 첫 번째 요소가 있다는 것을 알면 이 요소를 사용하여 첫 번째 요소를 읽거나 씁니다.

예시

// cliext_list_front.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(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 item
    System::Console::WriteLine("front() = {0}", c1.front());

    // alter first item and reinspect
    c1.front() = L'x';
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();
    return (0);
    }
a b c
front() = a
x b c

list::front_item(STL/CLR)

첫 번째 요소에 액세스합니다.

구문

property value_type front_item;

설명

이 속성은 비어 있어야 하는 제어된 시퀀스의 첫 번째 요소에 액세스합니다. 첫 번째 요소가 있다는 것을 알면 이 요소를 사용하여 첫 번째 요소를 읽거나 씁니다.

예시

// cliext_list_front_item.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(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 item
    System::Console::WriteLine("front_item = {0}", c1.front_item);

    // alter first item and reinspect
    c1.front_item = L'x';
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();
    return (0);
    }
a b c
front_item = a
x b c

list::generic_container(STL/CLR)

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

구문

typedef Microsoft::VisualC::StlClr::
    IList<generic_value>
    generic_container;

설명

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

예시

// cliext_list_generic_container.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(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
    cliext::list<wchar_t>::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(gc1->end(), L'd');
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // modify original and display generic
    c1.push_back(L'e');

    System::Collections::IEnumerator^ enum1 =
        gc1->GetEnumerator();
    while (enum1->MoveNext())
        System::Console::Write("{0} ", enum1->Current);
    System::Console::WriteLine();
    return (0);
    }
a b c
a b c
a b c d
a b c d e

list::generic_iterator(STL/CLR)

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

구문

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

설명

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

예시

// cliext_list_generic_iterator.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(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
    cliext::list<wchar_t>::generic_container^ gc1 = %c1;
    for each (wchar_t elem in gc1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // modify generic and display original
    cliext::list<wchar_t>::generic_iterator gcit = gc1->begin();
    cliext::list<wchar_t>::generic_value gcval = *gcit;
    *++gcit = gcval;
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();
    return (0);
    }
a b c
a b c
a a c

list::generic_reverse_iterator(STL/CLR)

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

구문

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

설명

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

예시

// cliext_list_generic_reverse_iterator.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(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
    cliext::list<wchar_t>::generic_container^ gc1 = %c1;
    for each (wchar_t elem in gc1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // modify generic and display original
    cliext::list<wchar_t>::generic_reverse_iterator gcit = gc1->rbegin();
    cliext::list<wchar_t>::generic_value gcval = *gcit;
    *++gcit = gcval;
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();
    return (0);
    }
a b c
a b c
a c c

list::generic_value(STL/CLR)

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

구문

typedef GValue generic_value;

설명

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

예시

// cliext_list_generic_value.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(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
    cliext::list<wchar_t>::generic_container^ gc1 = %c1;
    for each (wchar_t elem in gc1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // modify generic and display original
    cliext::list<wchar_t>::generic_iterator gcit = gc1->begin();
    cliext::list<wchar_t>::generic_value gcval = *gcit;
    *++gcit = gcval;
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();
    return (0);
    }
a b c
a b c
a a c

list::insert(STL/CLR)

지정된 위치에 요소를 추가합니다.

구문

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

매개 변수

count
삽입할 요소의 수입니다.

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

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

right
삽입할 열거형입니다.

val
삽입할 요소의 값입니다.

where
컨테이너에서 이전에 삽입할 위치입니다.

설명

각 멤버 함수는 제어되는 시퀀스의 위치가 가리키는 요소 앞에 다시 기본 피연산자에서 지정한 시퀀스를 삽입합니다.

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

두 번째 멤버 함수는 value val의 count 요소 반복을 삽입합니다. 동일한 값의 모든 복사본인 0개 이상의 연속 요소를 삽입하는 데 사용합니다.

InIt가 정수 형식이면 세 번째 멤버 함수는 insert(where, (size_type)first, (value_type)last)와 동일하게 동작합니다. 그렇지 않으면 시퀀스 [, last)를first 삽입합니다. 다른 시퀀스에서 복사한 0개 이상의 연속 요소를 삽입하는 데 사용합니다.

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

단일 요소를 삽입할 때 요소 복사본 수는 삽입 지점과 시퀀스의 가까운 끝 사이의 요소 수에서 선형입니다. (시퀀스의 양쪽 끝에 하나 이상의 요소를 삽입하는 경우 요소 복사본이 발생하지 않습니다.) 입력 반복기인 경우 InIt 세 번째 멤버 함수는 시퀀스의 각 요소에 대해 단일 삽입을 효과적으로 수행합니다. 그렇지 않으면 요소를 삽입할 N 때 요소 복사본 수가 선형 N 으로 표시되고 삽입 지점과 시퀀스의 가까운 끝 사이의 요소 수가 추가됩니다.

예시

// cliext_list_insert.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(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 using iterator
    cliext::list<wchar_t>::iterator it = c1.begin();
    System::Console::WriteLine("insert(begin()+1, L'x') = {0}",
        *c1.insert(++it, L'x'));
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // insert a repetition of values
    cliext::list<wchar_t> c2;
    c2.insert(c2.begin(), 2, L'y');
    for each (wchar_t elem in c2)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

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

    // insert an enumeration
    c2.insert(c2.begin(),   // NOTE: cast is not needed
        (System::Collections::Generic::IEnumerable<wchar_t>^)%c1);
    for each (wchar_t elem in c2)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // insert a single value using index
    it = c2.begin();
    ++it, ++it, ++it;
    c2.insert(it, L'z');
    for each (wchar_t elem in c2)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    return (0);
    }
a b c
insert(begin()+1, L'x') = x
a x b c
y y
y y a x b
a x b c y y a x b

list::iterator(STL/CLR)

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

구문

typedef T1 iterator;

설명

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

예시

// cliext_list_iterator.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(L'c');

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

    // alter first element and redisplay
    it = c1.begin();
    *it = L'x';
    for (; it != c1.end(); ++it)
        System::Console::Write("{0} ", *it);
    System::Console::WriteLine();
    return (0);
    }
a b c
x b c

list::list(STL/CLR)

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

구문

list();
list(list<Value>% right);
list(list<Value>^ right);
explicit list(size_type count);
list(size_type count, value_type val);
template<typename InIt>
    list(InIt first, InIt last);
list(System::Collections::Generic::IEnumerable<Value>^ right);

매개 변수

count
삽입할 요소의 수입니다.

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

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

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

val
삽입할 요소의 값입니다.

설명

생성자:

list();

는 요소 없이 제어되는 시퀀스를 초기화합니다. 이를 사용하여 빈 초기 제어 시퀀스를 지정합니다.

생성자:

list(list<Value>% right);

는 시퀀스 [right.begin(), right.end())를 사용하여 제어되는 시퀀스를 초기화합니다. 목록 개체 오른쪽에 의해 제어되는 시퀀스의 복사본인 초기 제어 시퀀스를 지정하는 데 사용합니다.

생성자:

list(list<Value>^ right);

는 시퀀스 [right->begin(), right->end())를 사용하여 제어되는 시퀀스를 초기화합니다. 이를 사용하여 핸들 이 올바른 목록 개체에 의해 제어되는 시퀀스의 복사본인 초기 제어 시퀀스를 지정합니다.

생성자:

explicit list(size_type count);

각각 값value_type()이 있는 count 요소를 사용하여 제어되는 시퀀스를 초기화합니다. 컨테이너를 기본값이 있는 요소로 채우는 데 사용합니다.

생성자:

list(size_type count, value_type val);

는 각각 value val을 사용하여 count 요소를 사용하여 제어되는 시퀀스를 초기화합니다. 컨테이너를 모두 동일한 값을 갖는 요소로 채우는 데 사용합니다.

생성자:

template<typename InIt>

list(InIt first, InIt last);

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

생성자:

list(System::Collections::Generic::IEnumerable<Value>^ right);

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

예시

// cliext_list_construct.cpp
// compile with: /clr
#include <cliext/list>

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

    // construct with a repetition of default values
    cliext::list<wchar_t> c2(3);
    for each (wchar_t elem in c2)
        System::Console::Write("{0} ", (int)elem);
    System::Console::WriteLine();

    // construct with a repetition of values
    cliext::list<wchar_t> c3(6, L'x');
    for each (wchar_t elem in c3)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // construct with an iterator range
    cliext::list<wchar_t>::iterator it = c3.end();
    cliext::list<wchar_t> c4(c3.begin(), --it);
    for each (wchar_t elem in c4)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // construct with an enumeration
    cliext::list<wchar_t> 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 by copying another container
    cliext::list<wchar_t> c7(c3);
    for each (wchar_t elem in c7)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // construct by copying a container handle
    cliext::list<wchar_t> c8(%c3);
    for each (wchar_t elem in c8)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    return (0);
    }
size() = 0
0 0 0
x x x x x x
x x x x x
x x x x x x
x x x x x x
x x x x x x

list::merge(STL/CLR)

두 개의 순서가 지정된 제어 시퀀스를 병합합니다.

구문

void merge(list<Value>% right);
template<typename Pred2>
    void merge(list<Value>% right, Pred2 pred);

매개 변수

Pred
요소 쌍에 대한 비교자입니다.

right
병합할 컨테이너입니다.

설명

첫 번째 멤버 함수는 오른쪽에 의해 제어되는 시퀀스에서 모든 요소를 제거하고 제어되는 시퀀스에 삽입합니다. 두 시퀀스 모두 이전에 순서를 operator< 지정해야 합니다. 두 시퀀스를 진행하는 동안 요소의 값이 감소해서는 안 됩니다. 결과 시퀀스도 .에 의해 operator<정렬됩니다. 이 멤버 함수를 사용하여 값이 증가하는 두 시퀀스를 값이 증가하는 시퀀스로 병합합니다.

두 번째 멤버 함수는 시퀀스의 순서가 지정된 경우 시퀀스의 요소를 Y 따르는 모든 요소 Xpred(X, Y)pred -- 대해 false여야 한다는 점을 제외하고 첫 번째 멤버 함수와 동일하게 동작합니다. 이를 사용하여 지정한 조건자 함수 또는 대리자에서 정렬된 두 시퀀스를 병합합니다.

두 함수 모두 안정적인 병합을 수행합니다. 원래 제어되는 시퀀스 중 하나에 있는 요소 쌍은 결과 제어 시퀀스에서 반전되지 않습니다. 또한 한 쌍의 요소 XY 결과 제어 시퀀스에 동일한 순서 !(X < Y) && !(X < Y) 가 있는 경우 원래 제어되는 시퀀스의 요소가 오른쪽으로 제어되는 시퀀스의 요소 앞에 나타납니다.

예시

// cliext_list_merge.cpp
// compile with: /clr
#include <cliext/list>

typedef cliext::list<wchar_t> Mylist;
int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'c');
    c1.push_back(L'e');

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

    cliext::list<wchar_t> c2;
    c2.push_back(L'b');
    c2.push_back(L'd');
    c2.push_back(L'f');

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

    // merge and display
    cliext::list<wchar_t> c3(c1);
    c3.merge(c2);
    for each (wchar_t elem in c3)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();
    System::Console::WriteLine("c2.size() = {0}", c2.size());

    // sort descending, merge descending, and redisplay
    c1.sort(cliext::greater<wchar_t>());
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    c3.sort(cliext::greater<wchar_t>());
    for each (wchar_t elem in c3)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    c3.merge(c1, cliext::greater<wchar_t>());
    for each (wchar_t elem in c3)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();
    System::Console::WriteLine("c1.size() = {0}", c1.size());
    return (0);
    }
a c e
b d f
a b c d e f
c2.size() = 0
e c a
f e d c b a
f e e d c c b a a
c1.size() = 0

list::operator=(STL/CLR)

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

구문

list<Value>% operator=(list<Value>% right);

매개 변수

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

설명

멤버 연산자는 개체에 바로 복사한 다음 반환합니다 *this. 제어되는 시퀀스를 오른쪽에 있는 제어된 시퀀스의 복사본으로 바꾸는 데 사용합니다.

예시

// cliext_list_operator_as.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(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
    cliext::list<wchar_t> 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

list::pop_back(STL/CLR)

마지막 요소를 제거합니다.

구문

void pop_back();

설명

멤버 함수는 제어되는 시퀀스의 마지막 요소를 제거합니다. 이 요소는 비어 있어야 합니다. 이 값을 사용하여 목록을 뒤쪽의 한 요소씩 줄입니다.

예시

// cliext_list_pop_back.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(L'c');

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

    // pop an element and redisplay
    c1.pop_back();
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();
    return (0);
    }
a b c
a b

list::pop_front(STL/CLR)

첫 번째 요소를 제거합니다.

구문

void pop_front();

설명

멤버 함수는 제어되는 시퀀스의 첫 번째 요소를 제거합니다. 이 요소는 비어 있어야 합니다. 앞면에서 한 요소씩 목록을 단축하는 데 사용합니다.

예시

// cliext_list_pop_front.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(L'c');

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

    // pop an element and redisplay
    c1.pop_front();
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();
    return (0);
    }
a b c
b c

list::push_back(STL/CLR)

새 마지막 요소를 추가합니다.

구문

void push_back(value_type val);

설명

멤버 함수는 제어되는 시퀀스의 끝에 값 val 이 있는 요소를 삽입합니다. 목록에 다른 요소를 추가하는 데 사용합니다.

예시

// cliext_list_push_back.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(L'c');

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

list::push_front(STL/CLR)

새 첫 번째 요소를 추가합니다.

구문

void push_front(value_type val);

설명

멤버 함수는 제어되는 시퀀스의 시작 부분에 값 val 이 있는 요소를 삽입합니다. 목록에 다른 요소를 앞에 추가하는 데 사용합니다.

예시

// cliext_list_push_front.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_front(L'a');
    c1.push_front(L'b');
    c1.push_front(L'c');

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

list::rbegin(STL/CLR)

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

구문

reverse_iterator rbegin();

설명

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

예시

// cliext_list_rbegin.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(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
    cliext::list<wchar_t>::reverse_iterator rit = c1.rbegin();
    System::Console::WriteLine("*rbegin() = {0}", *rit);
    System::Console::WriteLine("*++rbegin() = {0}", *++rit);

    // alter first two items and reinspect
    *--rit = L'x';
    *++rit = L'y';
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();
    return (0);
    }
a b c
*rbegin() = c
*++rbegin() = b
a y x

list::reference(STL/CLR)

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

구문

typedef value_type% reference;

설명

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

예시

// cliext_list_reference.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(L'c');

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

    // modify contents " a b c"
    for (it = c1.begin(); it != c1.end(); ++it)
        {   // get a reference to an element
        cliext::list<wchar_t>::reference ref = *it;

        ref += (wchar_t)(L'A' - L'a');
        System::Console::Write("{0} ", ref);
        }
    System::Console::WriteLine();
    return (0);
    }
a b c
A B C

list::remove(STL/CLR)

지정된 값을 가진 요소를 제거합니다.

구문

void remove(value_type val);

매개 변수

val
제거할 요소의 값입니다.

설명

멤버 함수는 제어되는 시퀀스에서 ((System::Object^)val)->Equals((System::Object^)x) true인 요소를 제거합니다(있는 경우). 지정된 값으로 임의의 요소를 지우는 데 사용합니다.

예시

// cliext_list_remove.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(L'c');

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

    // fail to remove and redisplay
    c1.remove(L'A');
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

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

list::remove_if(STL/CLR)

지정된 테스트를 통과하는 요소를 제거합니다.

구문

template<typename Pred1>
    void remove_if(Pred1 pred);

매개 변수

Pred
제거할 요소를 테스트합니다.

설명

멤버 함수는 true인 모든 요소를 Xpred(X) 제어된 시퀀스(지우기)에서 제거합니다. 함수 또는 대리자로 지정한 조건을 충족하는 모든 요소를 제거하는 데 사용합니다.

예시

// cliext_list_remove_if.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(L'b');
    c1.push_back(L'b');
    c1.push_back(L'c');

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

    // fail to remove and redisplay
    c1.remove_if(cliext::binder2nd<cliext::equal_to<wchar_t> >(
        cliext::equal_to<wchar_t>(), L'd'));
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // remove and redisplay
    c1.remove_if(cliext::binder2nd<cliext::not_equal_to<wchar_t> >(
        cliext::not_equal_to<wchar_t>(), L'b'));
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();
    return (0);
    }
a b b b c
a b b b c
b b b

list::rend(STL/CLR)

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

구문

reverse_iterator rend();

설명

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

예시

// cliext_list_rend.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(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
    cliext::list<wchar_t>::reverse_iterator rit = c1.rend();
    --rit;
    System::Console::WriteLine("*-- --rend() = {0}", *--rit);
    System::Console::WriteLine("*--rend() = {0}", *++rit);

    // alter first two items and reinspect
    *--rit = L'x';
    *++rit = L'y';
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();
    return (0);
    }
a b c
*-- --rend() = b
*--rend() = a
y x c

list::resize(STL/CLR)

요소 수를 변경합니다.

구문

void resize(size_type new_size);
void resize(size_type new_size, value_type val);

매개 변수

new_size
제어되는 시퀀스의 새 크기입니다.

val
패딩 요소의 값입니다.

설명

멤버 함수는 모두 list::size(STL/CLR)()가 new_size 반환하는지 확인합니다. 제어되는 시퀀스를 더 길게 만들어야 하는 경우 첫 번째 멤버 함수는 값 value_type()이 있는 요소를 추가하고 두 번째 멤버 함수는 value val을 사용하여 요소를 추가합니다. 제어되는 시퀀스를 더 짧게 만들기 위해 두 멤버 함수는 마지막 요소 목록::size(STL/CLR)() -new_size 시간을 효과적으로 지웁니다. 현재 제어되는 시퀀스를 트리밍하거나 패딩하여 제어되는 시퀀스의 크기 가 new_size 있는지 확인하는 데 사용합니다.

예시

// cliext_list_resize.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
// construct an empty container and pad with default values
    cliext::list<wchar_t> c1;
    System::Console::WriteLine("size() = {0}", c1.size());
    c1.resize(4);
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", (int)elem);
    System::Console::WriteLine();

    // resize to empty
    c1.resize(0);
    System::Console::WriteLine("size() = {0}", c1.size());

    // resize and pad
    c1.resize(5, L'x');
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();
    return (0);
    }
size() = 0
0 0 0 0
size() = 0
x x x x x

list::reverse(STL/CLR)

제어된 시퀀스를 반대로 바뀝니다.

구문

void reverse();

설명

멤버 함수는 제어되는 시퀀스의 모든 요소 순서를 반대로 바뀝니다. 이를 사용하여 요소 목록을 반영합니다.

예시

// cliext_list_reverse.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(L'c');

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

    // reverse and redisplay
    c1.reverse();
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();
    return (0);
    }
a b c
c b a

list::reverse_iterator(STL/CLR)

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

구문

typedef T3 reverse_iterator;

설명

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

예시

// cliext_list_reverse_iterator.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(L'c');

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

    // alter first element and redisplay
    rit = c1.rbegin();
    *rit = L'x';
    for (; rit != c1.rend(); ++rit)
        System::Console::Write("{0} ", *rit);
    System::Console::WriteLine();
    return (0);
    }
c b a
x b a

list::size(STL/CLR)

요소 수를 계산합니다.

구문

size_type size();

설명

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

예시

// cliext_list_size.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(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.push_back(L'a');
    c1.push_back(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

list::size_type(STL/CLR)

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

구문

typedef int size_type;

설명

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

예시

// cliext_list_size_type.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(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
    cliext::list<wchar_t>::size_type diff = 0;
    for (cliext::list<wchar_t>::iterator it = c1.begin();
        it != c1.end(); ++it)
        ++diff;
    System::Console::WriteLine("end()-begin() = {0}", diff);
    return (0);
    }
a b c
end()-begin() = 3

list::sort(STL/CLR)

제어된 시퀀스를 정렬합니다.

구문

void sort();
template<typename Pred2>
    void sort(Pred2 pred);

매개 변수

Pred
요소 쌍에 대한 비교자입니다.

설명

첫 번째 멤버 함수는 제어되는 시퀀스의 요소를 다시 정렬하여 순서를 operator< 지정합니다. 시퀀스를 진행하는 동안 요소의 값이 감소하지 않습니다. 이 멤버 함수를 사용하여 순서를 순서대로 정렬합니다.

두 번째 멤버 함수는 결과 시퀀스의 요소를 Y 따르는 요소 X 에 대해 순서pred(X, Y)pred -- 가 false인 경우를 제외하고 첫 번째 멤버 함수와 동일하게 동작합니다. 이를 사용하여 조건자 함수 또는 대리자가 지정한 순서대로 시퀀스를 정렬합니다.

두 함수 모두 안정적인 정렬을 수행합니다. 원래 제어되는 시퀀스의 요소 쌍은 결과 제어 시퀀스에서 반전되지 않습니다.

예시

// cliext_list_sort.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(L'c');

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

    // sort descending and redisplay
    c1.sort(cliext::greater<wchar_t>());
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // sort ascending and redisplay
    c1.sort();
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();
    return (0);
    }
a b c
c b a
a b c

list::splice(STL/CLR)

노드 간의 Restitch 링크입니다.

구문

void splice(iterator where, list<Value>% right);
void splice(iterator where, list<Value>% right,
    iterator first);
void splice(iterator where, list<Value>% right,
    iterator first, iterator last);

매개 변수

first
스플라이스할 범위의 시작입니다.

last
스플라이스할 범위의 끝입니다.

right
스플라이스할 컨테이너입니다.

where
컨테이너에서 이전에 스플라이스할 위치입니다.

설명

첫 번째 멤버 함수는 제어되는 시퀀스의 요소 바로 앞에 제어되는 시퀀스를 삽입합니다. 또한 오른쪽에서 모든 요소를 제거합니다. (%right 와 같 this아서는 안 됩니다.) 한 목록을 모두 다른 목록으로 스플라이스하는 데 사용합니다.

두 번째 멤버 함수는 오른쪽에 의해 제어되는 시퀀스에서 먼저 가리키는 요소를 제거하고 제어되는 시퀀스의 요소 앞에 삽입합니다. (이 경우 where== ++first==first||where변경이 발생하지 않습니다.) 한 목록의 단일 요소를 다른 목록으로 스플라이스하는 데 사용합니다.

세 번째 멤버 함수는 제어되는 시퀀스의 요소 바로 앞에 제어되는 시퀀스에서 [first, last)로 지정된 하위 정렬을 삽입합니다. 또한 오른쪽에 의해 제어되는 시퀀스에서 원래 하위 정렬을 제거합니다. (경우 right == this범위 [first, last)에 위치가 가리키는 요소를 포함하면 안 됩니다.) 한 목록에서 다른 목록으로 0개 이상의 요소의 하위 시퀀스를 스플라이스하는 데 사용합니다.

예시

// cliext_list_splice.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(L'c');

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

    // splice to a new list
    cliext::list<wchar_t> c2;
    c2.splice(c2.begin(), c1);
    System::Console::WriteLine("c1.size() = {0}", c1.size());
    for each (wchar_t elem in c2)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // return one element
    c1.splice(c1.end(), c2, c2.begin());
    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 remaining elements
    c1.splice(c1.begin(), c2, c2.begin(), c2.end());
    for each (wchar_t elem in c1)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();
    System::Console::WriteLine("c2.size() = {0}", c2.size());
    return (0);
    }
a b c
c1.size() = 0
a b c
a
b c
b c a
c2.size() = 0

list::swap(STL/CLR)

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

구문

void swap(list<Value>% right);

매개 변수

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

설명

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

예시

// cliext_list_swap.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(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
    cliext::list<wchar_t> c2(5, L'x');
    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

list::to_array(STL/CLR)

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

구문

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

설명

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

예시

// cliext_list_to_array.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(L'c');

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

    c1.push_back(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

list::unique(STL/CLR)

지정된 테스트를 통과하는 인접 요소를 제거합니다.

구문

void unique();
template<typename Pred2>
    void unique(Pred2 pred);

매개 변수

Pred
요소 쌍에 대한 비교자입니다.

설명

첫 번째 멤버 함수는 제어된 시퀀스(지우기)에서 이전 요소와 동일한 요소를 비교합니다. 요소가 X 요소 앞에 있고 X == Y멤버 함수가 제거되면 제거됩니다YY. 이를 사용하여 같음과 비교하는 인접 요소의 모든 하위 시퀀스에 대한 복사본을 하나만 제거합니다. list::sort(STL/CLR)()를 호출하는 것과 같이 제어된 시퀀스의 순서가 지정된 경우 멤버 함수는 고유한 값을 가진 요소만 남습니다. (그래서 이러한 이름을 갖습니다.)

두 번째 멤버 함수는 요소 다음에 있는 각 요소를 Y 제거한다는 점을 제외하고 첫 번째 멤버 Xpred(X, Y)함수와 동일하게 동작합니다. 이를 사용하여 지정한 조건자 함수 또는 대리자를 충족하는 인접 요소의 모든 하위 시퀀스의 복사본을 하나만 제거합니다. 호출 sort(pred)과 같이 제어된 시퀀스가 정렬되는 경우 멤버 함수는 다른 요소와 동일한 순서가 없는 요소만 남습니다.

예시

// cliext_list_unique.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(L'c');

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

    // display contents after unique
    cliext::list<wchar_t> c2(c1);
    c2.unique();
    for each (wchar_t elem in c2)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();

    // display contents after unique(not_equal_to)
    c2 = c1;
    c2.unique(cliext::not_equal_to<wchar_t>());
    for each (wchar_t elem in c2)
        System::Console::Write("{0} ", elem);
    System::Console::WriteLine();
    return (0);
    }
a a b c
a b c
a a

list::value_type(STL/CLR)

요소의 형식입니다.

구문

typedef Value value_type;

설명

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

예시

// cliext_list_value_type.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(L'c');

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

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

operator!= (list)(STL/CLR)

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

구문

template<typename Value>
    bool operator!=(list<Value>% left,
        list<Value>% right);

매개 변수

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

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

설명

연산자 함수는 .를 반환합니다 !(left == right). 두 목록을 요소별로 비교할 때 왼쪽이 오른쪽같은 순서가 아닌지 테스트하는 데 사용합니다.

예시

// cliext_list_operator_ne.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(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
    cliext::list<wchar_t> c2;
    c2.push_back(L'a');
    c2.push_back(L'b');
    c2.push_back(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< (list) (STL/CLR)

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

구문

template<typename Value>
    bool operator<(list<Value>% left,
        list<Value>% right);

매개 변수

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

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

설명

연산자 함수는 true인 가장 낮은 위치에 i 대해 !(right[i] < left[i]) true를 반환합니다 left[i] < right[i]. 그렇지 않으면 left->size() < right->size() 두 목록을 요소별로 비교할 때 왼쪽이 오른쪽 앞에 정렬되는지 여부를 테스트하는 데 사용합니다.

예시

// cliext_list_operator_lt.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(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
    cliext::list<wchar_t> c2;
    c2.push_back(L'a');
    c2.push_back(L'b');
    c2.push_back(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<= (list) (STL/CLR)

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

구문

template<typename Value>
    bool operator<=(list<Value>% left,
        list<Value>% right);

매개 변수

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

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

설명

연산자 함수는 .를 반환합니다 !(right < left). 두 목록을 요소별로 비교할 때 왼쪽이 오른쪽의 순서가 지정되지 않는지 여부를 테스트하는 데 사용합니다.

예시

// cliext_list_operator_le.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(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
    cliext::list<wchar_t> c2;
    c2.push_back(L'a');
    c2.push_back(L'b');
    c2.push_back(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== (list)(STL/CLR)

같음 비교를 나열합니다.

구문

template<typename Value>
    bool operator==(list<Value>% left,
        list<Value>% right);

매개 변수

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

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

설명

연산자 함수는 왼쪽과 오른쪽으로 제어되는 시퀀스의 길이가 같고 각 위치에 left[i] ==iright[i]대해 true를 반환합니다. 두 목록을 요소별로 비교할 때 왼쪽이 오른쪽같은 순서인지 여부를 테스트하는 데 사용합니다.

예시

// cliext_list_operator_eq.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(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
    cliext::list<wchar_t> c2;
    c2.push_back(L'a');
    c2.push_back(L'b');
    c2.push_back(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> (list) (STL/CLR)

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

구문

template<typename Value>
    bool operator>(list<Value>% left,
        list<Value>% right);

매개 변수

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

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

설명

연산자 함수는 .를 반환합니다 right<left. 두 목록을 요소별로 비교할 때 왼쪽 순서가 오른쪽인지 여부를 테스트하는 데 사용합니다.

예시

// cliext_list_operator_gt.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(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
    cliext::list<wchar_t> c2;
    c2.push_back(L'a');
    c2.push_back(L'b');
    c2.push_back(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>= (list) (STL/CLR)

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

구문

template<typename Value>
    bool operator>=(list<Value>% left,
        list<Value>% right);

매개 변수

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

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

설명

연산자 함수는 .를 반환합니다 !(left<right). 두 목록을 요소별로 비교할 때 왼쪽이 오른쪽 앞에 정렬되지 않는지 여부를 테스트하는 데 사용합니다.

예제

// cliext_list_operator_ge.cpp
// compile with: /clr
#include <cliext/list>

int main()
    {
    cliext::list<wchar_t> c1;
    c1.push_back(L'a');
    c1.push_back(L'b');
    c1.push_back(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
    cliext::list<wchar_t> c2;
    c2.push_back(L'a');
    c2.push_back(L'b');
    c2.push_back(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