]> git.saurik.com Git - wxWidgets.git/blame - docs/doxygen/overviews/container.h
added Id keyword
[wxWidgets.git] / docs / doxygen / overviews / container.h
CommitLineData
15b6757b
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: container
3// Purpose: topic overview
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
9/*!
36c9828f 10
15b6757b 11 @page container_overview Container classes overview
36c9828f 12
15b6757b
FM
13 Classes: #wxListT, #wxArrayT, #wxVectorT
14 wxWidgets uses itself several container classes including doubly-linked lists
15 and dynamic arrays (i.e. arrays which expand automatically when they become
16 full). For both historical and portability reasons wxWidgets does not
17 use STL which provides the standard implementation of many container classes in
18 C++. First of all, wxWidgets has existed since well before STL was written, and
19 secondly we don't believe that today compilers can deal really well with all of
20 STL classes (this is especially @true for some less common platforms). Of
21 course, the compilers are evolving quite rapidly and hopefully their progress
22 will allow to base future versions of wxWidgets on STL - but this is not yet
23 the case.
24 wxWidgets container classes don't pretend to be as powerful or full as STL
25 ones, but they are quite useful and may be compiled with absolutely any C++
26 compiler. They're used internally by wxWidgets, but may, of course, be used in
27 your programs as well if you wish.
28 The list classes in wxWidgets are doubly-linked lists which may either own the
29 objects they contain (meaning that the list deletes the object when it is
30 removed from the list or the list itself is destroyed) or just store the
36c9828f 31 pointers depending on whether you called or not
15b6757b
FM
32 wxList::DeleteContents method.
33 Dynamic arrays resemble C arrays but with two important differences: they
34 provide run-time range checking in debug builds and they automatically expand
35 the allocated memory when there is no more space for new items. They come in
36 two sorts: the "plain" arrays which store either built-in types such as "char",
37 "int" or "bool" or the pointers to arbitrary objects, or "object arrays" which
38 own the object pointers to which they store.
39 For the same portability reasons, the container classes implementation in wxWidgets
40 does not use templates, but is rather based on C preprocessor i.e. is done with
41 the macros: @e WX_DECLARE_LIST and @e WX_DEFINE_LIST for the linked
42 lists and @e WX_DECLARE_ARRAY, @e WX_DECLARE_OBJARRAY and @e WX_DEFINE_OBJARRAY for
43 the dynamic arrays. The "DECLARE" macro declares a
44 new container class containing the elements of given type and is needed for all
45 three types of container classes: lists, arrays and objarrays. The "DEFINE"
46 classes must be inserted in your program in a place where the @b full
47 declaration of container element class is in scope (i.e. not just forward
48 declaration), otherwise destructors of the container elements will not be
49 called! As array classes never delete the items they contain anyhow, there is
50 no WX_DEFINE_ARRAY macro for them.
36c9828f 51 Examples of usage of these macros may be found in #wxList and
15b6757b
FM
52 #wxArray documentation.
53 Finally, wxWidgets predefines several commonly used container classes. wxList
54 is defined for compatibility with previous versions as a list containing
55 wxObjects and wxStringList as a list of C-style strings (char *), both of these
56 classes are deprecated and should not be used in new programs. The following
57 array classes are defined: wxArrayInt, wxArrayLong, wxArrayPtrVoid and
58 wxArrayString. The first three store elements of corresponding types, but
59 wxArrayString is somewhat special: it is an optimized version of wxArray which
60 uses its knowledge about #wxString reference counting
61 schema.
36c9828f 62
15b6757b 63 */
36c9828f
FM
64
65