다음을 통해 공유


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);

매개 변수

  • 첫 번째
    스플라이스 범위의 시작 부분입니다.

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

  • right
    스플라이스에서 하는 컨테이너입니다.

  • where
    스플라이스 앞에 컨테이너에 위치 합니다.

설명

첫 번째 멤버 함수에 의해 제어 되는 시퀀스를 삽입 합니다. right 가 가리키는 제어 되는 시퀀스의 요소 앞에 where.또한 모든 요소를 제거 right.(%right must not equal this.) 모두 하나의 목록에 다른 스플라이스를 사용 합니다.

가 가리키는 요소를 제거 하는 두 번째 멤버 함수 first 에 의해 제어 되는 시퀀스에서 right 하 고 제어 되는 시퀀스의 요소를 가리키는 전에 삽입 where.(If where == first || where == ++first, no change occurs.) 단일 요소를 하나의 목록에 다른 스플라이스를 사용 합니다.

세 번째 멤버 함수가 지정 하위 범위의 삽입 [first, last) 에 의해 제어 되는 시퀀스에서 right 가 가리키는 제어 되는 시퀀스의 요소 앞 where.에 의해 제어 되는 시퀀스에서 또한 원래 하위 제거 right.(If right == this, the range [first, last) must not include the element pointed to by where.) 하나의 목록에서 0 개 이상의 요소를 subsequence 다른 스플라이스를 사용 합니다.

예제

// 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); 
    } 
 
  

요구 사항

헤더: < cliext/목록 >

네임 스페이스: cliext

참고 항목

참조

list (STL/CLR)

list::assign (STL/CLR)

list::insert (STL/CLR)

list::merge (STL/CLR)