티스토리 뷰
CArray
template< class TYPE, class ARG_TYPE > class CArray : public CObject
Parameters
TYPE
Template parameter specifying the type of objects stored in the array. TYPE is a parameter that is returned by CArray.
ARG_TYPE
Template parameter specifying the argument type used to access objects stored in the array. Often a reference to TYPE. ARG_TYPE is a parameter that is passed to CArray.
RemarksThe CArray class supports arrays that are are similar to C arrays, but can dynamically shrink and grow as necessary.
Array indexes always start at position 0. You can decide whether to fix the upper bound or allow the array to expand when you add elements past the current bound. Memory is allocated contiguously to the upper bound, even if some elements are null.
As with a C array, the access time for a CArray indexed element is constant and is independent of the array size.
Tip Before using an array, use SetSize to establish its size and allocate memory for it. If you do not use SetSize, adding elements to your array causes it to be frequently reallocated and copied. Frequent reallocation and copying are inefficient and can fragment memory.
If you need a dump of individual elements in an array, you must set the depth of the CDumpContext object to 1 or greater.
Certain member functions of this class call global helper functions that must be customized for most uses of the CArray class. See the topic Collection Class Helpers in the Macros and Globals section.
When elements are removed from a CArray object, the helper function DestructElements is called. When elements are added, the helper function ConstructElements is called.
Array class derivation is similar to list derivation.
For more information on using CArray, see the article
Collections in Visual C++ Programmer's
Guide.
#include <afxtempl.h>
Class Members | Base Class | Hierarchy Chart
CArray Class Members
Construction
CArray | Constructs an empty array. |
Attributes
GetSize | Gets the number of elements in this array. |
GetUpperBound | Returns the largest valid index. |
SetSize | Sets the number of elements to be contained in this array. |
Operations
FreeExtra | Frees all unused memory above the current upper bound. |
RemoveAll | Removes all the elements from this array. |
Element Access
GetAt | Returns the value at a given index. |
SetAt | Sets the value for a given index; array not allowed to grow. |
ElementAt | Returns a temporary reference to the element pointer within the array. |
GetData | Allows access to elements in the array. Can be NULL. |
Growing the Array
SetAtGrow | Sets the value for a given index; grows the array if necessary. |
Add | Adds an element to the end of the array; grows the array if necessary. |
Append | Appends another array to the array; grows the array if necessary |
Copy | Copies another array to the array; grows the array if necessary. |
Insertion/Removal
InsertAt | Inserts an element (or all the elements in another array) at a specified index. |
RemoveAt | Removes an element at a specific index. |
Operators
operator [] | Sets or gets the element at the specified index. |
- Total
- Today
- Yesterday
- React
- jsp 오픈 소스
- 인텔리제이(intellij)
- jstl(java standard tag library)
- 스프링 프레임워크(spring framewordk)
- nl2br
- java web-mvc
- java.sql
- MainActor
- System.Diagnostics
- 스프링 프레임워크(spring framework)
- error-java
- 람다식(lambda expression)
- await
- 메이븐(maven)
- 스프링 시큐리티(spring security)
- 스프링 시큐리티(spring security)-http basic 인증
- java-개발 환경 설정하기
- jstl(java standard tag library)-core
- java 키워드 정리
- 특정 문자를 기준으로 자르기
- 표현 언어(expression language)
- 진수 변환
- .submit()
- 문자 자르기
- 제품 등록
- REST API
- docker
- system.io
- In App Purchase
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |