mirror of
https://github.com/xfarrow/lasd.git
synced 2025-06-05 21:49:14 +02:00
Library 5
- Added template - Matrix & MatrixVec completed
This commit is contained in:
57
librerie/exercise5/queue/queue.hpp
Executable file
57
librerie/exercise5/queue/queue.hpp
Executable file
@ -0,0 +1,57 @@
|
||||
|
||||
#ifndef QUEUE_HPP
|
||||
#define QUEUE_HPP
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../container/container.hpp"
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
namespace lasd {
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
template <typename Data>
|
||||
class Queue : virtual public Container{ // Must extend Container
|
||||
|
||||
private:
|
||||
|
||||
protected:
|
||||
|
||||
public:
|
||||
|
||||
// Destructor
|
||||
~Queue() = default;
|
||||
|
||||
/* ************************************************************************ */
|
||||
|
||||
// Copy assignment
|
||||
Queue& operator=(const Queue&) = delete; // Copy assignment of abstract types should not be possible.
|
||||
|
||||
// Move assignment
|
||||
Queue& operator=(Queue&&) = delete; // Move assignment of abstract types should not be possible.
|
||||
|
||||
/* ************************************************************************ */
|
||||
|
||||
// Comparison operators
|
||||
bool operator==(const Queue&) const noexcept = delete; // Comparison of abstract types might not be possible.
|
||||
bool operator!=(const Queue&) const noexcept = delete; // Comparison of abstract types might not be possible.
|
||||
|
||||
/* ************************************************************************ */
|
||||
|
||||
// Specific member functions
|
||||
|
||||
virtual void Enqueue(const Data&) = 0; // Copy of the value
|
||||
virtual void Enqueue(Data&&) = 0; // Move of the value
|
||||
virtual Data& Head() const = 0; // (concrete function must throw std::length_error when empty)
|
||||
virtual void Dequeue() = 0; // (concrete function must throw std::length_error when empty)
|
||||
virtual Data HeadNDequeue() = 0; // (concrete function must throw std::length_error when empty)
|
||||
|
||||
};
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
}
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user