인클루드 <afxtempl.h>
CList<타입,타입&> list;
여기서 POSITION (pos)를 따로 선언하여 필요할 때 사용.
<- Tail --------------- Head ->
<- Next --------------- Prev ->
<- After --------------- Before ->
List 안에 있는 값을 얻을 때 개수 범위가 넘었는지를 확인 해주어야 한다. 안그러면 ASSERT 발동
Head/Tail 접근
GetHead | list의 head element를 리턴한다. (empty면 할 수 없다). |
GetTail | list의 tail element를 리턴한다.(empty면 할 수 없다). |
Operations(조정)
AddHead |
하나의 element(또는 다른 list의 모든element들)을 list의 head에 추가한다(새로운 head를 만든다). |
AddTail |
하나의 element(또는 다른 list의 모든element들)을 list의 tail에 추가한다(새로운 tail를 만든다). |
RemoveAll | list의 모든 element를 제거한다. |
RemoveHead | list의 head로부터 element를 제거한다. |
RemoveTail | list의 tail로부터 element를 제거한다. |
Iteration(반복)
GetHeadPosition | head의 position을 리턴한다. |
GetNext |
(position이) 반복되어 다음 element로 도달한다.(원래 인수로 넣었던 position의 값으로 리턴하고 position을 다음 위치로 바꿔진다) |
GetPrev |
(position이) 반복되어 이전 element로 도달한다.(원래 인수로 넣었던 position의 값으로 리턴하고 position을 이전 위치로 바꿔진다) |
GetTailPosition | tail position을 리턴한다. |
Retrieval(정정)/Modification(수정)
GetAt | 주어진 position에서 element(값)을 얻는다. |
RemoveAt | position에 의해 정해진 element 를 list로부터 제거한다. |
SetAt | 주어진 position에서 element(값)을 넣는다. |
Insertion(삽입)
InsertAfter | 주어진 position 뒤에 새로운 element를 삽입한다. |
InsertBefore | 주어진 position 앞에 새로운 element를 삽입한다. |
Searching(찾기)
Find | pointer 값에 의해 정해진 position을 얻는다. |
FindIndex | zero-based index 값에 의해 정해진 position을 얻는다. |
Status(상태)
GetCount | list의 element 개수를 리턴한다 |
GetSize | list의 element 개수를 리턴한다 |
IsEmpty | 비어있는 상태인지 검사한다.(no elements). |