Data Structures & Algorithms in C++
Goodrich, Tamassia, Mount and Goldwasser
Loading...
Searching...
No Matches
Data Structures | Public Member Functions | Friends
dsac::list::CircularlyLinkedList< T > Class Template Reference

circularly linked list More...

#include <circularly_linked.h>

Collaboration diagram for dsac::list::CircularlyLinkedList< T >:
Collaboration graph

Public Member Functions

 CircularlyLinkedList ()
 Constructs an empty list.
 
int size () const
 
bool empty () const
 
T & front ()
 
const T & front () const
 
T & back ()
 
const T & back () const
 
void push_front (const T &elem)
 
void push_back (const T &elem)
 
void pop_front ()
 Removes the first element of the list.
 
void rotate ()
 Rotates the first element to the back of the list.
 
void clear ()
 Resets the list to empty.
 
 CircularlyLinkedList (const CircularlyLinkedList &other)
 Copy constructor.
 
CircularlyLinkedListoperator= (const CircularlyLinkedList &other)
 Copy assignment.
 
 CircularlyLinkedList (CircularlyLinkedList &&other)
 Move constructor.
 
CircularlyLinkedListoperator= (CircularlyLinkedList &&other)
 Move assignment.
 
 ~CircularlyLinkedList ()
 default destructor
 

Friends

void swap (CircularlyLinkedList &a, CircularlyLinkedList &b)
 non-member function to swap two lists
 

Detailed Description

template<typename T>
class dsac::list::CircularlyLinkedList< T >

circularly linked list

Constructor & Destructor Documentation

◆ CircularlyLinkedList() [1/3]

template<typename T >
dsac::list::CircularlyLinkedList< T >::CircularlyLinkedList ( )
inline

Constructs an empty list.

◆ CircularlyLinkedList() [2/3]

template<typename T >
dsac::list::CircularlyLinkedList< T >::CircularlyLinkedList ( const CircularlyLinkedList< T > &  other)
inline

Copy constructor.

◆ CircularlyLinkedList() [3/3]

template<typename T >
dsac::list::CircularlyLinkedList< T >::CircularlyLinkedList ( CircularlyLinkedList< T > &&  other)
inline

Move constructor.

◆ ~CircularlyLinkedList()

template<typename T >
dsac::list::CircularlyLinkedList< T >::~CircularlyLinkedList ( )
inline

default destructor

Here is the call graph for this function:

Member Function Documentation

◆ back() [1/2]

template<typename T >
T & dsac::list::CircularlyLinkedList< T >::back ( )
inline

Returns live reference to the last element of the list; behavior undefined if list is empty

Returns
reference to last element of the list

◆ back() [2/2]

template<typename T >
const T & dsac::list::CircularlyLinkedList< T >::back ( ) const
inline

Returns const reference to the last element of the list; behavior undefined if list is empty

Returns
reference to last element of the list

◆ clear()

template<typename T >
void dsac::list::CircularlyLinkedList< T >::clear ( )
inline

Resets the list to empty.

Here is the call graph for this function:

◆ empty()

template<typename T >
bool dsac::list::CircularlyLinkedList< T >::empty ( ) const
inline

Tests whether the list is empty.

Returns
true if the list is empty, false otherwise

◆ front() [1/2]

template<typename T >
T & dsac::list::CircularlyLinkedList< T >::front ( )
inline

Returns live reference to the first element of the list; behavior undefined if list is empty

Returns
reference to first element of the list

◆ front() [2/2]

template<typename T >
const T & dsac::list::CircularlyLinkedList< T >::front ( ) const
inline

Returns const reference to the first element of the list; behavior undefined if list is empty

Returns
reference to first element of the list

◆ operator=() [1/2]

template<typename T >
CircularlyLinkedList & dsac::list::CircularlyLinkedList< T >::operator= ( CircularlyLinkedList< T > &&  other)
inline

Move assignment.

◆ operator=() [2/2]

template<typename T >
CircularlyLinkedList & dsac::list::CircularlyLinkedList< T >::operator= ( const CircularlyLinkedList< T > &  other)
inline

Copy assignment.

Here is the call graph for this function:

◆ pop_front()

template<typename T >
void dsac::list::CircularlyLinkedList< T >::pop_front ( )
inline

Removes the first element of the list.

◆ push_back()

template<typename T >
void dsac::list::CircularlyLinkedList< T >::push_back ( const T &  elem)
inline

Inserts element at the end of the list

Parameters
elemthe new element
Here is the call graph for this function:

◆ push_front()

template<typename T >
void dsac::list::CircularlyLinkedList< T >::push_front ( const T &  elem)
inline

Inserts element at the beginning of the list

Parameters
elemthe new element

◆ rotate()

template<typename T >
void dsac::list::CircularlyLinkedList< T >::rotate ( )
inline

Rotates the first element to the back of the list.

◆ size()

template<typename T >
int dsac::list::CircularlyLinkedList< T >::size ( ) const
inline

Returns the number of elements stored

Returns
the number of elements stored

Friends And Related Symbol Documentation

◆ swap

template<typename T >
void swap ( CircularlyLinkedList< T > &  a,
CircularlyLinkedList< T > &  b 
)
friend

non-member function to swap two lists


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