Skip to content

Class eva::List

template <class ItemClass>

ClassList > eva > List

Simple singly-linked list container. More...

  • #include <evaList.h>

Public Functions

Type Name
List () = default
Default constructor.
List (const List & other)
Copy constructor - performs deep copy.
void append (ItemClass item)
Appends an item to the list.
void clear ()
Removes all items from the list.
unsigned count () const
Gets number of items in list.
ListIterator< ItemClass > * first ()
Gets first iterator.
int indexOf (const ItemClass & item) const
Finds index of first occurrence of an item.
bool isEmpty () const
Checks if list is empty.
List & operator= (const List & other)
Assignment operator - performs deep copy.
ItemClass * operator[] (unsigned short index)
Array-style access by index.
bool remove (const ItemClass & item)
Removes first occurrence of an item.
bool removeAt (unsigned short index)
Removes item at specified index.
~List ()
Destructor - frees all nodes.

Detailed Description

Template parameters:

  • ItemClass Type of items to store

Public Functions Documentation

function List [1/2]

Default constructor.

eva::List::List () = default

function List [2/2]

Copy constructor - performs deep copy.

inline eva::List::List (
    const List & other
) 

Parameters:

  • other List to copy from

function append

Appends an item to the list.

inline void eva::List::append (
    ItemClass item
) 

Parameters:

  • item Item to append

function clear

Removes all items from the list.

inline void eva::List::clear () 

function count

Gets number of items in list.

inline unsigned eva::List::count () const

Returns:

Item count


function first

Gets first iterator.

inline ListIterator < ItemClass > * eva::List::first () 

Returns:

Pointer to first iterator


function indexOf

Finds index of first occurrence of an item.

inline int eva::List::indexOf (
    const ItemClass & item
) const

Parameters:

  • item Item to find

Returns:

Index of item, or -1 if not found


function isEmpty

Checks if list is empty.

inline bool eva::List::isEmpty () const

Returns:

true if list has no items


function operator=

Assignment operator - performs deep copy.

inline List & eva::List::operator= (
    const List & other
) 

Parameters:

  • other List to copy from

Returns:

Reference to this list


function operator[]

Array-style access by index.

inline ItemClass * eva::List::operator[] (
    unsigned short index
) 

Parameters:

  • index Index (0-based)

Returns:

Pointer to item or nullptr if index out of bounds


function remove

Removes first occurrence of an item.

inline bool eva::List::remove (
    const ItemClass & item
) 

Parameters:

  • item Item to remove

Returns:

true if item was found and removed


function removeAt

Removes item at specified index.

inline bool eva::List::removeAt (
    unsigned short index
) 

Parameters:

  • index Index of item to remove (0-based)

Returns:

true if index is valid and item was removed


function ~List

Destructor - frees all nodes.

inline eva::List::~List () 


The documentation for this class was generated from the following file src/evaList.h