Library 5

- Added template
- Matrix & MatrixVec completed
This commit is contained in:
Alessandro Ferro
2021-05-25 22:19:44 +02:00
parent b7c12b8c8a
commit b3ca7292c1
63 changed files with 7683 additions and 0 deletions

View File

@@ -0,0 +1,171 @@
#ifndef ITERATOR_HPP
#define ITERATOR_HPP
/* ************************************************************************** */
namespace lasd {
/* ************************************************************************** */
template <typename Data>
class Iterator {
private:
protected:
public:
// Destructor
virtual ~Iterator() = default;
/* ************************************************************************ */
// Copy assignment
Iterator& operator=(const Iterator&) = delete; // Copy assignment of abstract types should not be possible.
// Move assignment
Iterator& operator=(Iterator&&) noexcept = delete; // Move assignment of abstract types should not be possible.
/* ************************************************************************ */
// Comparison operators
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
virtual Data& operator*() const = 0; // (concrete function must throw std::out_of_range when terminated)
virtual bool Terminated() const noexcept = 0; // (concrete function should not throw exceptions)
};
/* ************************************************************************** */
template <typename Data>
class ForwardIterator : virtual public Iterator<Data> { // Must extend Iterator
private:
protected:
public:
// Destructor
virtual ~ForwardIterator() = default;
/* ************************************************************************ */
// Copy assignment
ForwardIterator& operator=(const ForwardIterator&) = delete; // Copy assignment of abstract types should not be possible.
// Move assignment
ForwardIterator& operator=(ForwardIterator&&) noexcept = delete; // Move assignment of abstract types should not be possible.
/* ************************************************************************ */
// Comparison operators
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
virtual void operator++() = 0; // (concrete function must throw std::out_of_range when terminated)
};
/* ************************************************************************** */
template <typename Data>
class BackwardIterator { // Must extend Iterator
private:
// ...
protected:
// ...
public:
// Destructor
// ~BackwardIterator() specifiers
/* ************************************************************************ */
// Copy assignment
// type operator=(argument); // Copy assignment of abstract types should not be possible.
// Move assignment
// type operator=(argument); // 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.
/* ************************************************************************ */
// Specific member functions
// type operator--() specifiers; // (concrete function must throw std::out_of_range when terminated)
};
/* ************************************************************************** */
template <typename Data>
class BidirectionalIterator { // Must extend ForwardIterator and BackwardIterator
private:
// ...
protected:
// ...
public:
// Destructor
// ~BidirectionalIterator() specifiers
/* ************************************************************************ */
// Copy assignment
// type operator=(argument); // Copy assignment of abstract types should not be possible.
// Move assignment
// type operator=(argument); // 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.
/* ************************************************************************ */
// Specific member functions
// type Terminated() specifiers; // Override Iterator member
// type ForwardTerminated() specifiers; // (concrete function should not throw exceptions)
// type BackwardTerminated() specifiers; // (concrete function should not throw exceptions)
};
/* ************************************************************************** */
}
#endif