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:
90
librerie/exercise5/queue/lst/queuelst.hpp
Executable file
90
librerie/exercise5/queue/lst/queuelst.hpp
Executable file
@@ -0,0 +1,90 @@
|
||||
|
||||
#ifndef QUEUELST_HPP
|
||||
#define QUEUELST_HPP
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../queue.hpp"
|
||||
#include "../../list/list.hpp"
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
namespace lasd {
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
template <typename Data>
|
||||
class QueueLst : virtual public Queue<Data>,
|
||||
virtual protected List<Data>{ // Must extend Queue<Data> and List<Data>
|
||||
|
||||
private:
|
||||
|
||||
protected:
|
||||
|
||||
using List<Data>::head;
|
||||
using List<Data>::tail;
|
||||
using List<Data>::size;
|
||||
using typename List<Data>::Node;
|
||||
|
||||
public:
|
||||
|
||||
// Default constructor
|
||||
QueueLst() = default;
|
||||
|
||||
/* ************************************************************************ */
|
||||
|
||||
// Specific constructor
|
||||
QueueLst(const LinearContainer<Data>&); // A queue obtained from a LinearContainer
|
||||
|
||||
/* ************************************************************************ */
|
||||
|
||||
// Copy constructor
|
||||
QueueLst(const QueueLst&);
|
||||
|
||||
// Move constructor
|
||||
QueueLst(QueueLst&&) noexcept;
|
||||
|
||||
/* ************************************************************************ */
|
||||
|
||||
// Destructor
|
||||
~QueueLst();
|
||||
|
||||
/* ************************************************************************ */
|
||||
|
||||
// Copy assignment
|
||||
QueueLst& operator=(const QueueLst&);
|
||||
|
||||
// Move assignment
|
||||
QueueLst& operator=(QueueLst&&) noexcept;
|
||||
|
||||
/* ************************************************************************ */
|
||||
|
||||
// Comparison operators
|
||||
bool operator==(const QueueLst&) const noexcept;
|
||||
bool operator!=(const QueueLst&) const noexcept;
|
||||
|
||||
/* ************************************************************************ */
|
||||
|
||||
// Specific member functions (inherited from Queue)
|
||||
|
||||
void Enqueue(const Data&) override; // Override Queue member (copy of the value)
|
||||
void Enqueue(Data&&) override; // Override Queue member (move of the value)
|
||||
Data& Head() const override; // Override Queue member (must throw std::length_error when empty)
|
||||
void Dequeue() override; // Override Queue member (must throw std::length_error when empty)
|
||||
Data HeadNDequeue() override; // Override Queue member (must throw std::length_error when empty)
|
||||
|
||||
/* ************************************************************************ */
|
||||
|
||||
// Specific member functions (inherited from Container)
|
||||
|
||||
void Clear() override; // Override Container member
|
||||
|
||||
};
|
||||
|
||||
/* ************************************************************************** */
|
||||
|
||||
}
|
||||
|
||||
#include "queuelst.cpp"
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user