The DynamicList class
The DynamicList
class can be regarded as a more advanced version of the C++ standard classes list
and vector
. It varies its size dynamically:
DynamicList.h
namespace SmallWindows { template <class Type> class DynamicList { public:
The IfFuncPtr
pointer is a function prototype that is used when testing (without changing) a value in the list. It takes a constant value and a void
pointer and returns a Boolean
value. DoFuncPtr
is used when changing a value in the list and takes a (non-constant) value and a void
pointer. The void pointers are sent by the calling methods; they hold additional information:
typedef bool (*IfFuncPtr)(const Type& value, void* voidPtr); typedef void (*DoFuncPtr)(Type& value, void* voidPtr);
The list can be initialized by, and assigned to, another list. The default constructor creates an empty list, and the destructor deallocates the memory from the list:
DynamicList(); ...