| Xavax C++ Library | Class Index FAQ Overview |
operator=.
Due to the overhead of storing elements by value,
this container is only recommended for storing
native types and small objects.
For larger objects,
consider using PSList<T> which stores pointers to objects.
| Constructor Summary |
SList()
Construct an empty list. |
SList(const SList<T>& src)
Construct a new list that is a copy of src. |
| Operator Summary | |
SList<T>&
|
operator=(SList<T>& src)
Remove all elements, then copy the elements of src to this list. |
| Method Summary | |
void
|
append(const T& t)
Append an object of type T to the end of the list. |
void
|
clear()
Remove all elements from the list. |
size_t
|
count() const
Returns the number of elements in the list. |
T*
|
first()
Returns a pointer to the first element in the list. |
void
|
insert(const T& t, size_t p= 0)
Insert object t of type T at position p in the list. |
T*
|
last
Returns a pointer to the last element in the list. |
T*
|
locate(size_t p)
Locate and return a pointer to the element at position p. |
T*
|
locate(bool (proc)(T*,void*), void* data)
Locate and return a pointer to the element selected by proc. |
T
|
remove(size_t p)
Remove and return the element at position p. |
void
|
traverse(TraversalOrder order,
void (proc)(T*,void*), void* data)
Traverse the list in the specified order calling proc for each element. |
| Related Classes | |
| SListConstIterator<T>, SListIterator<T>, PSList<T> | |
| Constructor Detail |
SList<T>()
SList<T>(const SList<T>& src)
src - the list to be copied.
| Operator Detail |
SList<T>& operator=(SList<T>& src)
src - the list to be copied.
| Method Detail |
void append(const T& t)
t - an object of type T to be
inserted into the list.void clear()
size_t count() const
T* first()
void insert(const T& t, size_t p= 0)
t - the object to be inserted in the list.p - the position at which the object should be inserted.T* last();
T* locate(size_t p)
p - the position of the object to be retrieved.T* locate(bool (proc)(T*,void*), void* data)
proc - a function that returns true if an element is selected.data - can be used to pass client data to proc.T remove(size_t p)
p - the position of the object to be removed.
RangeException
- if the list contains fewer than p+1 elements.
void traverse(TraversalOrder order, void (proc)(T*,void*), void* data);
order - the order of the traversal.proc - the function to be called for each element.data - can be used to pass client data to proc.
| Example Code |
Copyright © 2003 Xavax Inc. -- All Rights Reserved