Reference Guide: Containers

This section is a reference guide to classes/interfaces built by API on top of Container abstract data type:

To see a real life example how can above classes be used, please have a look at unit tests.

Container

Interface that defines operations one can perform on a Container abstract data type

Signature

template <typename T> class Container

Methods

Method Signature Description
~Container virtual ~Container () Deletes container elements from memory
clear virtual void clear () = 0 Clears container of all elements
size virtual const std::size_t& size () const = 0 Gets number of elements in container
isEmpty virtual bool isEmpty () const = 0 Checks if container is empty of elements
peek virtual const T& peek () const = 0 Gets element from container
pop virtual T pop () = 0 Removes element from container and returns its value
push virtual void push (const T& item) = 0 Adds element to container

Queue

Class that implements Queue data structure on top of Container abstract data type

Signature

template <typename T> class Queue : public Container<T>

Additional Methods

Method Signature Description
Queue Queue () Constructs a queue

Stack

Class that implements Stack data structure on top of Container abstract data type

Signature

template <typename T> class Stack : public Container<T>

Additional Methods

Method Signature Description
Stack Stack () Constructs a stack

Share