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

View File

@ -13,78 +13,70 @@ class Iterator {
private:
// ...
protected:
// ...
public:
// Destructor
// ~Iterator() specifiers
virtual ~Iterator() = default;
/* ************************************************************************ */
// Copy assignment
// type operator=(argument); // Copy assignment of abstract types should not be possible.
Iterator& operator=(const Iterator&) = delete; // Copy assignment of abstract types should not be possible.
// Move assignment
// type operator=(argument); // Move assignment of abstract types should not be possible.
Iterator& operator=(Iterator&&) noexcept = 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 Iterator&) const noexcept = delete; // Comparison of abstract types might not be possible.
bool operator!=(const Iterator&) const noexcept = delete; // Comparison of abstract types might not be possible.
/* ************************************************************************ */
// Specific member functions
// type operator*() specifiers; // (concrete function must throw std::out_of_range when terminated)
virtual Data& operator*() = 0; // (concrete function must throw std::out_of_range when terminated)
// type Terminated() specifiers; // (concrete function should not throw exceptions)
virtual bool Terminated() noexcept = 0; // (concrete function should not throw exceptions)
};
/* ************************************************************************** */
template <typename Data>
class ForwardIterator { // Must extend Iterator
class ForwardIterator : virtual public Iterator<Data> { // Must extend Iterator
private:
// ...
protected:
// ...
public:
// Destructor
// ~ForwardIterator() specifiers
virtual ~ForwardIterator() = default;
/* ************************************************************************ */
// Copy assignment
// type operator=(argument); // Copy assignment of abstract types should not be possible.
ForwardIterator& operator=(const ForwardIterator&) = delete; // Copy assignment of abstract types should not be possible.
// Move assignment
// type operator=(argument); // Move assignment of abstract types should not be possible.
ForwardIterator& operator=(ForwardIterator&&) noexcept = 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 ForwardIterator&) const noexcept = delete; // Comparison of abstract types might not be possible.
bool operator!=(const ForwardIterator&) const noexcept = delete; // Comparison of abstract types might not be possible.
/* ************************************************************************ */
// Specific member functions
// type operator++() specifiers; // (concrete function must throw std::out_of_range when terminated)
virtual ForwardIterator& operator++() = 0; // (concrete function must throw std::out_of_range when terminated)
};