Lolly 1.4.27
Loading...
Searching...
No Matches
Private Member Functions | Static Private Attributes | Friends | List of all members
list< T > Class Template Reference

The list class represents a linked list. More...

#include <list.hpp>

Inheritance diagram for list< T >:
Inheritance graph
[legend]
Collaboration diagram for list< T >:
Collaboration graph
[legend]

Private Member Functions

 CONCRETE_NULL_TEMPLATE (list, T)
 
 list (T item)
 Construct a new list object with a single item.
 
 list (T item, list< T > next)
 Construct a new list object with an item and a pointer to the next node.
 
 list (T item1, T item2, list< T > next)
 Construct a new list object with two items and a pointer to the next node.
 
 list (T item1, T item2, T item3, list< T > next)
 Construct a new list object with three items and a pointer to the next node.
 
T & operator[] (int i)
 Overloaded subscript operator to access the item at a specific index in the list.
 

Static Private Attributes

static list< T > init = list<T> ()
 A static list object used for initializing new list objects.
 

Friends

bool is_atom LESSGTR (list< T > l)
 
bool strong_equal LESSGTR (list< T > l1, list< T > l2)
 

Detailed Description

template<class T>
class list< T >

The list class represents a linked list.

Template Parameters
TThe type of the data stored in the list.

Definition at line 48 of file list.hpp.

Constructor & Destructor Documentation

◆ list() [1/4]

template<class T >
list< T >::list ( T item)
inlineprivate

Construct a new list object with a single item.

Parameters
itemThe item to be stored in the list.

Definition at line 137 of file list.hpp.

138 : rep (tm_new<list_rep<T>> (item, list<T> ())) {}
The list class represents a linked list.
Definition list.hpp:48
C * tm_new()
base class of resources
Definition resource.hpp:23

◆ list() [2/4]

template<class T >
list< T >::list ( T item,
list< T > next )
inlineprivate

Construct a new list object with an item and a pointer to the next node.

Parameters
itemThe item to be stored in the list.
nextA pointer to the next node in the list.

Definition at line 139 of file list.hpp.

140 : rep (tm_new<list_rep<T>> (item, next)) {}

◆ list() [3/4]

template<class T >
list< T >::list ( T item1,
T item2,
list< T > next )
inlineprivate

Construct a new list object with two items and a pointer to the next node.

Parameters
item1The first item to be stored in the list.
item2The second item to be stored in the list.
nextA pointer to the next node in the list.

Definition at line 141 of file list.hpp.

142 : rep (tm_new<list_rep<T>> (item1, list<T> (item2, next))) {}

◆ list() [4/4]

template<class T >
list< T >::list ( T item1,
T item2,
T item3,
list< T > next )
inlineprivate

Construct a new list object with three items and a pointer to the next node.

Parameters
item1The first item to be stored in the list.
item2The second item to be stored in the list.
item3The third item to be stored in the list.
nextA pointer to the next node in the list.

Definition at line 143 of file list.hpp.

144 : rep (tm_new<list_rep<T>> (item1, list<T> (item2, item3, next))) {}

Member Function Documentation

◆ CONCRETE_NULL_TEMPLATE()

template<class T >
list< T >::CONCRETE_NULL_TEMPLATE ( list< T > ,
T  )
private

◆ operator[]()

template<class T >
T & list< T >::operator[] ( int i)
private

Overloaded subscript operator to access the item at a specific index in the list.

Parameters
iThe index of the item to be accessed.
Returns
T& A reference to the item at the specified index.

Definition at line 37 of file list.ipp.

37 {
38 ASSERT (rep != NULL, "list too short");
39 if (i == 0) return rep->item;
40 return rep->next[i - 1];
41}
#define ASSERT(cond, msg)
Macro used to assert that a condition is true, and throw an exception with an error message if the co...
Definition basic.hpp:85

Friends And Related Symbol Documentation

◆ LESSGTR [1/2]

template<class T >
bool is_atom LESSGTR ( list< T > l)
friend

◆ LESSGTR [2/2]

template<class T >
bool strong_equal LESSGTR ( list< T > l1,
list< T > l2 )
friend

Member Data Documentation

◆ init

template<class T >
list< T > list< T >::init = list<T> ()
staticprivate

A static list object used for initializing new list objects.

Definition at line 100 of file list.hpp.


The documentation for this class was generated from the following files: