deque(STL/CLR)

템플릿 클래스는 임의 액세스 권한이 있는 다양한 길이의 요소 시퀀스를 제어하는 개체를 설명합니다. 컨테이너 deque 를 사용하여 연속 스토리지 블록처럼 보이지만 다시 기본 요소를 복사할 필요 없이 양쪽 끝에서 증가하거나 축소할 수 있는 요소 시퀀스를 관리합니다. 따라서 효율적으로 구현할 수 있습니다.double-ended queue (따라서 이름입니다.)

아래 GValue 설명에서 후자는 ref 형식이 아니면 동일합니다 Value . 이 경우는 다음과 같습니다 Value^.

구문

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

매개 변수

GValue
제어되는 시퀀스에 있는 요소의 제네릭 형식입니다.


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

요구 사항

헤더:<cliext/deque>

네임스페이스: cliext

선언

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

인터페이스

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

설명

개체는 요소 블록을 Value 지정하는 저장된 핸들 배열을 통해 제어하는 시퀀스에 대한 스토리지를 할당하고 해제합니다. 배열은 요청 시 증가합니다. 증가는 새 요소 앞에 추가하거나 추가하는 비용이 일정한 시간이며 재기본 요소가 방해되지 않는 방식으로 발생합니다. 요소를 다시 기본 방해하지 않고 일정한 시간에 양쪽 끝에 있는 요소를 제거할 수도 있습니다. 따라서 deque는 템플릿 클래스 큐(STL/CLR) 또는 템플릿 클래스 스택(STL/CLR)의 기본 컨테이너에 적합한 후보입니다.

개체는 임의 deque 액세스 반복기를 지원합니다. 즉, 첫 번째(앞) 요소에 대해 0부터 마지막(뒤로) 요소의 deque::size(STL/CLR)() - 1로 계산되는 숫자 위치가 지정된 요소를 직접 참조할 수 있습니다. 또한 deque가 템플릿 클래스 priority_queue(STL/CLR)에 대한 기본 컨테이너에 적합한 후보임을 의미합니다.

deque 반복기는 지정된 요소의 바이어스와 함께 연결된 deque 개체에 대한 핸들을 저장합니다. 연결된 컨테이너 개체에서만 반복기를 사용할 수 있습니다. deque 요소의 바이어스는 해당 위치와 반드시 동일하지는 않습니다 . 삽입된 첫 번째 요소에는 바이어스 0이 있으며 다음 추가된 요소에는 바이어스 1이 있지만 다음 앞에 추가된 요소에는 바이어스 -1이 있습니다.

양쪽 끝에 요소를 삽입하거나 지우는 것은 유효한 바이어스에 저장된 요소의 값을 변경하지 않습니다. 그러나 내부 요소를 삽입하거나 지우면 지정된 바이어스에 저장된 요소 값이 변경될 수 있으므로 반복기에서 지정한 값도 변경할 수 있습니다. (컨테이너는 삽입 전에 구멍을 만들거나 지우기 후 구멍을 채우기 위해 요소를 위아래로 복사해야 할 수 있습니다.) 그럼에도 불구하고 deque 반복기는 해당 바이어스가 유효한 요소를 지정하는 한 유효한 기본. 또한 올바른 반복기가 역참조 가능하지 기본 해당 바이어스가 반환end()된 반복기의 바이어스와 같지 않은 한 해당 반복기를 사용하여 지정한 요소 값에 액세스하거나 변경할 수 있습니다.

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

멤버

deque::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_deque_assign.cpp
// compile with: /clr
#include <cliext/deque>

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

    // assign a repetition of values
    cliext::deque<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
    c2.assign(c1.begin(), c1.end() - 1);
    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

deque::at(STL/CLR)

지정된 위치에 있는 요소에 액세스합니다.

구문

reference at(size_type pos);

매개 변수

pos
액세스할 요소의 위치입니다.

설명

멤버 함수는 위치 pos에서 제어되는 시퀀스의 요소에 대한 참조를 반환합니다. 해당 위치를 알고 있는 요소를 읽거나 쓰는 데 사용합니다.

예시

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

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

    // display contents " a b c" using at
    for (int i = 0; i < c1.size(); ++i)
        System::Console::Write("{0} ", c1.at(i));
    System::Console::WriteLine();

    // change an entry and redisplay
    c1.at(1) = L'x';
    for (int i = 0; i < c1.size(); ++i)
        System::Console::Write("{0} ", c1[i]);
    System::Console::WriteLine();
    return (0);
    }
a b c
a x c

deque::back(STL/CLR)

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

구문

reference back();

설명

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

예시

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

int main()
    {
    cliext::deque<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

deque::back_item(STL/CLR)

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

구문

property value_type back_item;

설명

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

예시

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

int main()
    {
    cliext::deque<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

deque::begin(STL/CLR)

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

구문

iterator begin();

설명

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

예시

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

int main()
    {
    cliext::deque<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::deque<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

deque::clear(STL/CLR)

모든 요소를 제거합니다.

구문

void clear();

설명

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

예시

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

int main()
    {
    cliext::deque<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

deque::const_iterator(STL/CLR)

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

구문

typedef T2 const_iterator;

설명

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

예시

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

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

    // display contents " a b c"
    cliext::deque<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

deque::const_reference(STL/CLR)

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

구문

typedef value_type% const_reference;

설명

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

예시

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

int main()
    {
    cliext::deque<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::deque<wchar_t>::const_iterator cit = c1.begin();
    for (; cit != c1.end(); ++cit)
        {   // get a const reference to an element
        cliext::deque<wchar_t>::const_reference cref = *cit;
        System::Console::Write("{0} ", cref);
        }
    System::Console::WriteLine();
    return (0);
    }
a b c

deque::const_reverse_iterator(STL/CLR)

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

구문

typedef T4 const_reverse_iterator;

설명

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

예시

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

int main()
    {
    cliext::deque<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::deque<wchar_t>::const_reverse_iterator crit = c1.rbegin();
    cliext::deque<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

deque::deque(STL/CLR)

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

구문

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

매개 변수

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

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

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

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

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

설명

생성자:

deque();

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

생성자:

deque(deque<Value>% right);

는 시퀀스 [right.begin(), right.end())를 사용하여 제어되는 시퀀스를 초기화합니다. deque 개체 오른쪽에 의해 제어되는 시퀀스의 복사본인 초기 제어 시퀀스를 지정하는 데 사용합니다. 반복기에 대한 자세한 내용은 deque::begin(STL/CLR)deque::end(STL/CLR)를 참조하세요.

생성자:

deque(deque<Value>^ right);

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

생성자:

explicit deque(size_type count);

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

생성자:

deque(size_type count, value_type val);

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

생성자:

template<typename InIt>

deque(InIt first, InIt last);

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

생성자:

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

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

예시

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

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

    // construct with a repetition of default values
    cliext::deque<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::deque<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::deque<wchar_t>::iterator it = c3.end();
    cliext::deque<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::deque<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::deque<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::deque<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

deque::difference_type(STL/CLR)

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

구문

typedef int difference_type;

설명

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

예시

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

int main()
    {
    cliext::deque<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::deque<wchar_t>::difference_type diff = 0;
    for (cliext::deque<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::deque<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

deque::empty(STL/CLR)

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

구문

bool empty();

설명

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

예시

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

int main()
    {
    cliext::deque<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

deque::end(STL/CLR)

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

구문

iterator end();

설명

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

예시

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

int main()
    {
    cliext::deque<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::deque<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

deque::erase(STL/CLR)

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

구문

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

매개 변수

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

last
지울 범위의 끝입니다.

where
지울 요소입니다.

설명

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

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

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

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

예시

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

int main()
    {
    cliext::deque<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::deque<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

deque::front(STL/CLR)

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

구문

reference front();

설명

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

예시

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

int main()
    {
    cliext::deque<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

deque::front_item(STL/CLR)

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

구문

property value_type front_item;

설명

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

예시

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

int main()
    {
    cliext::deque<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

deque::generic_container(STL/CLR)

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

구문

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

설명

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

예시

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

int main()
    {
    cliext::deque<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::deque<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

deque::generic_iterator(STL/CLR)

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

구문

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

설명

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

예시

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

int main()
    {
    cliext::deque<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::deque<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::deque<wchar_t>::generic_iterator gcit = gc1->begin();
    cliext::deque<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

deque::generic_reverse_iterator(STL/CLR)

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

구문

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

설명

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

예시

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

int main()
    {
    cliext::deque<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::deque<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::deque<wchar_t>::generic_reverse_iterator gcit = gc1->rbegin();
    cliext::deque<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

deque::generic_value(STL/CLR)

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

구문

typedef GValue generic_value;

설명

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

예시

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

int main()
    {
    cliext::deque<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::deque<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::deque<wchar_t>::generic_iterator gcit = gc1->begin();
    cliext::deque<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

deque::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_deque_insert.cpp
// compile with: /clr
#include <cliext/deque>

int main()
    {
    cliext::deque<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::deque<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::deque<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();
    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

deque::iterator(STL/CLR)

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

구문

typedef T1 iterator;

설명

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

예시

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

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

    // display contents " a b c"
    cliext::deque<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

deque::operator!=(STL/CLR)

Deque가 같지 않은 비교입니다.

구문

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

매개 변수

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

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

설명

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

예시

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

int main()
    {
    cliext::deque<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::deque<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

deque::operator(STL/CLR)

지정된 위치에 있는 요소에 액세스합니다.

구문

reference operator[](size_type pos);

매개 변수

pos
액세스할 요소의 위치입니다.

설명

멤버 연산자는 위치 pos의 요소에 대한 참조를 반환합니다. 해당 위치를 알고 있는 요소에 액세스하는 데 사용합니다.

예시

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

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

    // display contents " a b c" using subscripting
    for (int i = 0; i < c1.size(); ++i)
        System::Console::Write("{0} ", c1[i]);
    System::Console::WriteLine();

    // change an entry and redisplay
    c1[1] = L'x';
    for (int i = 0; i < c1.size(); ++i)
        System::Console::Write("{0} ", c1[i]);
    System::Console::WriteLine();
    return (0);
    }
a b c
a x c

deque::pop_back(STL/CLR)

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

구문

void pop_back();

설명

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

예시

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

int main()
    {
    cliext::deque<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

deque::pop_front(STL/CLR)

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

구문

void pop_front();

설명

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

예시

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

int main()
    {
    cliext::deque<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

deque::push_back(STL/CLR)

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

구문

void push_back(value_type val);

설명

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

예시

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

int main()
    {
    cliext::deque<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

deque::push_front(STL/CLR)

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

구문

void push_front(value_type val);

설명

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

예시

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

int main()
    {
    cliext::deque<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

deque::rbegin(STL/CLR)

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

구문

reverse_iterator rbegin();

설명

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

예시

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

int main()
    {
    cliext::deque<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::deque<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

deque::reference(STL/CLR)

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

구문

typedef value_type% reference;

설명

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

예시

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

int main()
    {
    cliext::deque<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::deque<wchar_t>::iterator it = c1.begin();
    for (; it != c1.end(); ++it)
        {   // get a reference to an element
        cliext::deque<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::deque<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

deque::rend(STL/CLR)

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

구문

reverse_iterator rend();

설명

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

예시

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

int main()
    {
    cliext::deque<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::deque<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

deque::resize(STL/CLR)

요소 수를 변경합니다.

구문

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

매개 변수

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

val
패딩 요소의 값입니다.

설명

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

예시

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

int main()
    {
// construct an empty container and pad with default values
    cliext::deque<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

deque::reverse_iterator(STL/CLR)

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

구문

typedef T3 reverse_iterator;

설명

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

예시

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

int main()
    {
    cliext::deque<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::deque<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

deque::size(STL/CLR)

요소 수를 계산합니다.

구문

size_type size();

설명

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

예시

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

int main()
    {
    cliext::deque<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

deque::size_type(STL/CLR)

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

구문

typedef int size_type;

설명

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

예시

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

int main()
    {
    cliext::deque<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::deque<wchar_t>::size_type diff = c1.end() - c1.begin();
    System::Console::WriteLine("end()-begin() = {0}", diff);
    return (0);
    }
a b c
end()-begin() = 3

deque::swap(STL/CLR)

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

구문

void swap(deque<Value>% right);

매개 변수

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

설명

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

예시

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

int main()
    {
    cliext::deque<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::deque<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

deque::to_array(STL/CLR)

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

구문

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

설명

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

예시

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

int main()
    {
    cliext::deque<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

deque::value_type(STL/CLR)

요소의 형식입니다.

구문

typedef Value value_type;

설명

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

예시

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

int main()
    {
    cliext::deque<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::deque<wchar_t>::iterator it = c1.begin();
        it != c1.end(); ++it)
        {   // store element in value_type object
        cliext::deque<wchar_t>::value_type val = *it;

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

operator< (deque) (STL/CLR)

비교보다 작습니다.

구문

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

매개 변수

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

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

설명

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

예시

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

int main()
    {
    cliext::deque<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::deque<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<= (deque) (STL/CLR)

비교보다 작거나 같은 데크입니다.

구문

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

매개 변수

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

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

설명

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

예시

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

int main()
    {
    cliext::deque<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::deque<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= (deque)(STL/CLR)

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

구문

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

매개 변수

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

설명

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

예시

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

int main()
    {
    cliext::deque<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::deque<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

operator== (deque)(STL/CLR)

Deque 등가 비교입니다.

구문

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

매개 변수

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

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

설명

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

예시

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

int main()
    {
    cliext::deque<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::deque<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> (deque) (STL/CLR)

비교보다 큰 Deque입니다.

구문

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

매개 변수

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

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

설명

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

예시

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

int main()
    {
    cliext::deque<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::deque<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>= (deque) (STL/CLR)

비교보다 크거나 같은 데크입니다.

구문

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

매개 변수

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

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

설명

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

예제

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

int main()
    {
    cliext::deque<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::deque<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