Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Essential Tools Module Reference Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

RWTIsvSlist<T>

Module:  Essential Tools Module   Group:  Traditional Collection Classes


Does not inherit

Local Index

Members

Synopsis

#include <rw/tislist.h>
RWTIsvSlist<T> list;

Description

Class RWTIsvSlist<T> is a class that implements intrusive singly-linked lists.

An intrusive list is one where the member of the list must inherit from a common base class, in this case RWIsvSlink. The advantage of such a list is that memory and space requirements are kept to a minimum. The disadvantage is that the inheritance hierarchy is inflexible, making it slightly more difficult to use with an existing class. Class RWTValSlist<T,A> is offered as an alternative, non-intrusive, linked list.

See Stroustrup (1991; Section 8.3.1) for more information about intrusive lists.

Note that when you insert an item into an intrusive list, the actual item (not a copy) is inserted. Because each item carries only one link field, the same item cannot be inserted into more than one list, nor can it be inserted into the same list more than once.

Example

Program Output:

Public Constructors

RWTIsvSlist<T>();
RWTIsvSlist<T>(T* a);

Public Member Functions

void
append(T* a);
void
apply(void (*applyFun)(T*, void*), void* d);
T*
at(size_t i) const;
void
clear();
void
clearAndDestroy();
bool
contains(bool (*testFun)(const T*, void*), void* d) 
         const;
bool
containsReference(const T* a) const; 
size_t
entries() const; 
T*
find(bool (*testFun)(const T*, void*),void* d) const; 
T*
first() const; 
T*
get();
size_t
index(bool (*testFun)(const T*, void*),void* d) const; 
void
insert(T* a); 
void
insertAt(size_t i, T* a); 
bool
isEmpty() const; 
T*
last() const; 
size_t
occurrencesOf(bool (*testFun)(const T*, void*),
              void* d) const; 
size_t
occurrencesOfReference(const T* a) const; 
void
prepend(T* a); 
T*
remove(bool (*testFun)(const T*, void*),void* d); 
T*
removeAt(size_t i); 
T*
removeFirst();
T*
removeLast();
T*
removeReference(T* a); 


Previous fileTop of DocumentContentsIndex pageNext file

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.