wxWidgets: wxNode< T > Class Template Reference

| Version: 3.2.7

Public Member Functions | List of all members
wxNode< T > Class Template Reference
Class List by Category » Data Structures

`#include <wx/list.h>`

## Detailed Description

### template<typename T>
class wxNode< T >

wxNode<T> is the node structure used in linked lists (see wxList) and derived classes.

You should never use wxNode<T> class directly, however, because it works with untyped (`void` *) data and this is unsafe. Use wxNode<T>-derived classes which are automatically defined by WX_DECLARE_LIST and WX_DEFINE_LIST macros instead as described in wxList documentation (see example there).

Also note that although there is a class called wxNode, it is defined for backwards compatibility only and usage of this class is strongly deprecated.

In the documentation below, the type `T` should be thought of as a "template" parameter: this is the type of data stored in the linked list or, in other words, the first argument of WX_DECLARE_LIST macro. Also, wxNode is written as wxNodeT even though it isn't really a template class – but it helps to think of it as if it were.

Template Parameters

  T | The type stored in the wxNode.

##

Library: wxBase
Category: Data Structures

See also
  wxList<T>, wxHashTable

## Public Member Functions
T * | GetData () const
| Retrieves the client data pointer associated with the node. More...
wxNode< T > * | GetNext () const
| Retrieves the next node or NULL if this node is the last one. More...
wxNode< T > * | GetPrevious ()
| Retrieves the previous node or NULL if this node is the first one in the list. More...
int | IndexOf ()
| Returns the zero-based index of this node within the list. More...
void | SetData (T *data)
| Sets the data associated with the node (usually the pointer will have been set when the node was created). More...

## Member Function Documentation

## ◆ GetData()

template<typename T >

T* wxNode< T >::GetData | ( |  | ) | const

Retrieves the client data pointer associated with the node.

## ◆ GetNext()

template<typename T >

wxNode<T>* wxNode< T >::GetNext | ( |  | ) | const

Retrieves the next node or NULL if this node is the last one.

## ◆ GetPrevious()

template<typename T >

wxNode<T>* wxNode< T >::GetPrevious | ( |  | ) |

Retrieves the previous node or NULL if this node is the first one in the list.

## ◆ IndexOf()

template<typename T >

int wxNode< T >::IndexOf | ( |  | ) |

Returns the zero-based index of this node within the list.

The return value will be `wxNOT_FOUND` if the node has not been added to a list yet.

## ◆ SetData()

template<typename T >

void wxNode< T >::SetData | ( | T * | data | ) |

Sets the data associated with the node (usually the pointer will have been set when the node was created).