Library 3

container & iterator.hpp
This commit is contained in:
Alessandro Ferro
2021-04-24 18:39:57 +02:00
parent 31bf18d985
commit 0d599672c4
16 changed files with 1240 additions and 506 deletions

26
librerie/exercise3/stack/stack.hpp Normal file → Executable file
View File

@ -13,44 +13,40 @@ namespace lasd {
/* ************************************************************************** */
template <typename Data>
class Stack { // Must extend Container
class Stack : virtual public Container { // Must extend Container
private:
// ...
protected:
// ...
public:
// Destructor
// ~Stack() specifiers
virtual ~Stack() = default;
/* ************************************************************************ */
// Copy assignment
// type operator=(argument); // Copy assignment of abstract types should not be possible.
Stack& operator=(const Stack&) = delete; // Copy assignment of abstract types should not be possible.
// Move assignment
// type operator=(argument); // Move assignment of abstract types should not be possible.
Stack&operator=(Stack&&) = delete; // Move assignment of abstract types should not be possible.
/* ************************************************************************ */
// Comparison operators
// type operator==(argument) specifiers; // Comparison of abstract types might not be possible.
// type operator!=(argument) specifiers; // Comparison of abstract types might not be possible.
bool operator==(const Stack&) = delete; // Comparison of abstract types might not be possible.
bool operator!=(Stack&&) = delete; // Comparison of abstract types might not be possible.
/* ************************************************************************ */
// Specific member functions
// type Push(argument) specifiers; // Copy of the value
// type Push(argument) specifiers; // Move of the value
// type Top() specifiers; // (concrete function must throw std::length_error when empty)
// type Pop() specifiers; // (concrete function must throw std::length_error when empty)
// type TopNPop() specifiers; // (concrete function must throw std::length_error when empty)
virtual void Push(const Data&) = 0; // Copy of the value
virtual void Push(Data&&) = 0; // Move of the value
virtual Data& Top() const = 0; // (concrete function must throw std::length_error when empty)
virtual void Pop() = 0; // (concrete function must throw std::length_error when empty)
virtual Data TopNPop() = 0; // (concrete function must throw std::length_error when empty)
};