System::Collections::Generic::List 클래스

List class

List forward declaration.

template<typename T>class List : public virtual System::Object,
                                 public System::Collections::Generic::IList<T>
매개변수설명
T요소 타입.

Nested classes

메서드

메서드설명
_add_range(std::initializer_list<T>)C++ 전용.
Add(const T&) override리스트 끝에 요소를 추가합니다.
AddInitializer(int, const T *)리스트에 요소를 추가합니다; 초기화자를 변환할 때 사용됩니다.
AddRange(IEnumerablePtr)컬렉션(또는 자체)에서 모든 요소를 현재 리스트의 끝에 추가합니다.
AsReadOnly()이 컬렉션에 대한 읽기 전용 참조를 가져옵니다.
begin()컬렉션의 첫 번째 요소에 대한 반복자를 가져옵니다.
begin() constconst 한정 컬렉션의 첫 번째 요소에 대한 반복자를 가져옵니다.
BinarySearch(const T&) const정렬된 리스트에서 항목을 찾습니다.
BinarySearch(const T&, const SharedPtr<System::Collections::Generic::IComparer<T>>&) const정렬된 리스트에서 항목을 찾습니다.
BinarySearch(int, int, const T&, const SharedPtr<System::Collections::Generic::IComparer<T>>&) const정렬된 리스트에서 항목을 찾습니다.
cbegin() const컬렉션의 첫 번째 const 한정 요소에 대한 반복자를 가져옵니다.
cend() const컬렉션 끝 뒤에 존재하지 않는 const 한정 요소에 대한 반복자를 가져옵니다.
Clear() override모든 요소를 삭제합니다.
Contains(const T&) const override리스트에 항목이 존재하는지 확인합니다.
ConvertAll(Converter<T, OutputType>)다른 유형으로 변환된 요소들의 리스트를 생성합니다.
CopyTo(System::ArrayPtr<T>, int) override리스트 요소를 기존 배열 요소에 복사합니다.
CopyTo(const System::ArrayPtr<T>&)모든 요소를 기존 배열 요소에 복사합니다.
CopyTo(int, const System::ArrayPtr<T>&, int, int)지정된 인덱스부터 시작하는 요소들을 기존 배열 요소에 복사합니다.
crbegin() const컬렉션의 마지막 const 한정 요소에 대한 역방향 반복자를 가져옵니다 (역순에서 첫 번째).
crend() const컬렉션 시작 전에 존재하지 않는 const 한정 요소에 대한 역방향 반복자를 가져옵니다.
data()기본 데이터 구조 접근 함수입니다.
data() const기본 데이터 구조 접근 함수입니다.
end()컬렉션 끝 뒤에 존재하지 않는 요소에 대한 반복자를 가져옵니다.
end() constconst 한정 컬렉션 끝 뒤에 존재하지 않는 요소에 대한 반복자를 가져옵니다.
Exists(System::Predicate<T>)리스트에 특정 조건을 만족하는 요소가 존재하는지 확인합니다.
Find(System::Predicate<T>)특정 조건을 만족하는 요소를 찾습니다.
FindAll(System::Predicate<T>)특정 조건을 만족하는 요소들을 찾습니다.
FindIndex(System::Predicate<T>)특정 조건을 만족하는 요소를 찾습니다.
FindIndex(int, System::Predicate<T>)특정 조건을 만족하는 요소를 찾습니다.
FindIndex(int, int, System::Predicate<T>)특정 조건을 만족하는 요소를 찾습니다.
FindLast(System::Predicate<T>)특정 조건을 만족하는 마지막 요소를 찾습니다.
ForEach(System::Action<T>)리스트의 모든 요소에 동작을 적용합니다.
get_Capacity() const현재 리스트 용량을 가져옵니다.
get_Count() const override현재 리스트의 요소 개수를 가져옵니다.
GetEnumerator() override리스트 요소를 순회하기 위한 열거자를 가져옵니다.
GetRange(int, int)리스트의 슬라이스를 생성합니다.
idx_get(int) const override특정 위치의 요소를 가져옵니다.
idx_set(int, T) override특정 위치에 요소를 설정합니다.
IndexOf(const T&) const override특정 항목의 첫 번째 인덱스를 가져옵니다.
IndexOf(const T&, int) const리스트에서 특정 항목을 찾습니다.
Insert(int, const T&) override지정된 위치에 항목을 삽입합니다.
InsertRange(int, IEnumerablePtr)특정 위치에 데이터 범위를 삽입합니다.
LastIndexOf(const T&) const지정된 객체를 검색하고 전체 리스트 내에서 마지막으로 나타나는 위치의 0 기반 인덱스를 반환합니다.
LastIndexOf(const T&, int32_t) const지정된 객체를 검색하고 첫 번째 요소부터 지정된 인덱스까지 확장되는 List의 요소 범위 내에서 마지막으로 나타나는 위치의 0 기반 인덱스를 반환합니다.
LastIndexOf(const T&, int32_t, int32_t) const지정된 객체를 검색하고 지정된 개수의 요소를 포함하고 지정된 인덱스로 끝나는 List 범위 내에서 마지막 발생 위치의 0부터 시작하는 인덱스를 반환합니다.
List()빈 리스트를 생성합니다.
List(int)미리 정의된 용량을 가진 리스트를 생성합니다.
List(IEnumerablePtr)복사 생성자.
operator[](int)접근자 함수.
operator[](int) const접근자 함수.
rbegin()컬렉션의 마지막 요소에 대한 역방향 반복자를 가져옵니다 (역방향에서 첫 번째).
rbegin() constconst 한정 컬렉션의 마지막 요소에 대한 역방향 반복자를 가져옵니다 (역방향에서 첫 번째).
Remove(const T&) override리스트에서 특정 항목의 첫 번째 인스턴스를 제거합니다.
RemoveAll(Predicate<T>)특정 조건에 일치하는 모든 요소를 제거합니다.
RemoveAt(int) override지정된 위치의 항목을 제거합니다.
RemoveRange(int, int)리스트의 슬라이스를 제거합니다.
rend()컬렉션 시작 앞에 존재하지 않는 요소에 대한 역방향 반복자를 가져옵니다.
rend() constconst 한정 컬렉션 시작 앞에 존재하지 않는 요소에 대한 역방향 반복자를 가져옵니다.
Reverse()전체 리스트의 요소 순서를 반전시킵니다.
Reverse(int, int)리스트 슬라이스의 요소 순서를 반전시킵니다.
set_Capacity(int)리스트 용량을 설정합니다.
Sort(const SharedPtr<System::Collections::Generic::IComparer<T>>&)리스트의 요소를 정렬합니다.
Sort()기본 비교자를 사용하여 리스트의 요소를 정렬합니다.
Sort(int, int, SharedPtr<System::Collections::Generic::IComparer<T>>)리스트 슬라이스의 요소를 정렬합니다.
Sort(Comparison<T>, bool)리스트의 요소를 정렬합니다.
ToArray() const리스트를 배열로 변환합니다.
TrimExcess()리스트 용량을 크기에 맞게 조정합니다.
TrueForAll(System::Predicate<T>)컬렉션의 모든 요소가 지정된 조건에 정의된 조건을 만족하는지 확인합니다.
virtualizeBeginConstIterator() const override현재 컨테이너에 대한 begin const iterator 구현을 가져옵니다.
virtualizeBeginIterator() override현재 컨테이너에 대한 begin iterator 구현을 가져옵니다.
virtualizeEndConstIterator() const override현재 컨테이너에 대한 end const iterator 구현을 가져옵니다.
virtualizeEndIterator() override현재 컨테이너에 대한 end iterator 구현을 가져옵니다.

Typedefs

타입 정의설명
BaseType인터페이스 유형입니다.
const_iterator상수 반복자 타입.
const_reverse_iterator상수 역방향 반복자 타입.
IEnumerablePtr같은 유형의 요소를 보유하는 컨테이너입니다.
IEnumeratorPtrEnumerator 유형.
iterator반복자 타입.
reverse_iterator역방향 반복자 타입.
ValueType이 유형.
vector_tRTTI 정보.

비고

List - wrapper around std::vector to be used in translated code. Requires operator == to be impemented for element type. Objects of this class should only be allocated using System::MakeObject() function. Never create instance of this type on stack or using operator new, as it will result in runtime errors and/or assertion faults. Always wrap this class into System::SmartPtr pointer and use this pointer to pass it to functions as argument.

#include <system/collections/list.h>
#include <system/smart_ptr.h>

using namespace System;
using namespace System::Collections::Generic;

int main()
{
  // 첫 번째 리스트를 생성합니다.
  auto list1 = MakeObject<List<int>>();

  // 첫 번째 리스트를 채웁니다.
  list1->Add(3);
  list1->Add(1);
  list1->Add(-5);
  list1->Add(8);

  // 첫 번째 리스트를 정렬합니다.
  // 첫 번째 리스트 항목은 다음과 같습니다: {-5, 1, 3, 8}
  list1->Sort();

  // 인덱스 2의 항목을 제거합니다.
  // 첫 번째 리스트 항목은 다음과 같습니다: {-5, 1, 8}
  list1->RemoveAt(2);

  // 인덱스 1에 항목을 삽입합니다.
  // 첫 번째 리스트 항목은 다음과 같습니다: {-5, 15, 1, 8}
  list1->Insert(1, 15);

  // 두 번째 리스트를 생성합니다.
  auto list2 = MakeObject<List<int>>();

  // 두 번째 목록을 채우세요.
  list2->Add(10);
  list2->Add(20);
  list2->Add(30);

  // 두 번째 목록의 요소들을 첫 번째 목록에 추가하세요.
  list1->AddRange(list2);

  // 첫 번째 목록 항목을 출력하세요.
  for (const auto item: list1)
  {
    std::cout << item << ' ';
  }

  return 0;
}
/*
This code example produces the following output:
-5 15 1 8 10 20 30
*/

또 보기