Brumski's DSA Learning Project 1.3
For Learning Data Structures and Algorithms in C++
Loading...
Searching...
No Matches
MyQueue< T > Class Template Reference

This is a template class that represents the queue data structure. More...

#include <queue_dsa.hpp>

Classes

class  Node
 This is a template class that represents a single element of a queue, and it will be called "Node". More...
 

Public Member Functions

 MyQueue ()=default
 Default Constructor.
 
 MyQueue (const MyQueue< T > &)=delete
 Deleted copy constructor.
 
 MyQueue (MyQueue< T > &&other)=default
 Default Move constructor.
 
MyQueueoperator= (const MyQueue< T > &)=delete
 Deleted copy assignment operator.
 
MyQueueoperator= (MyQueue< T > &&other)=default
 Default Move assignment operator.
 
virtual MyQueue< T > & push_back (const T &value)
 Inserts a value at the end of the queue.
 
virtual T front_element ()
 Prints out the front element in the queue.
 
virtual T last_element ()
 Prints out the last element in the queue.
 
virtual T popFront ()
 Removes the first element in the queue.
 
virtual bool isEmpty ()
 Returns true if the queue is empty.
 

Private Attributes

std::shared_ptr< Node< T > > theFirst
 Pointer to the first element of the queue.
 
std::shared_ptr< Node< T > > theRear
 Pointer to the last element of the queue.
 

Detailed Description

template<class T>
class MyQueue< T >

This is a template class that represents the queue data structure.

It can take any basic C++ data type. It uses the First In First Out (FIFO) principle.

Constructor & Destructor Documentation

◆ MyQueue()

template<class T >
MyQueue< T >::MyQueue ( MyQueue< T > &&  other)
default

Default Move constructor.

Parameters
other- the object that you want to transfer ownership from

Member Function Documentation

◆ operator=()

template<class T >
MyQueue & MyQueue< T >::operator= ( MyQueue< T > &&  other)
default

Default Move assignment operator.

Parameters
other- the object that you want to transfer ownership from

◆ push_back()

template<class T >
virtual MyQueue< T > & MyQueue< T >::push_back ( const T &  value)
inlinevirtual

Inserts a value at the end of the queue.

Parameters
value- the value that you want to pass to the end of the queue

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