Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Generic
diff options
context:
space:
mode:
Commit8af2c4a6d53375e8815e4152ed4b7ffb166c6a2a (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-06-14 14:44:36 +0300
Committer
 Syndamia <kamen@syndamia.com>
2022-06-14 14:44:36 +0300
Files6d2348bb4e2db6e13d2e1fbc98ea657a4fda0020 /src/Generic
FMI-OOP-P2_Tables-8af2c4a6d53375e8815e4152ed4b7ffb166c6a2a.tar
FMI-OOP-P2_Tables-8af2c4a6d53375e8815e4152ed4b7ffb166c6a2a.tar.gz
FMI-OOP-P2_Tables-8af2c4a6d53375e8815e4152ed4b7ffb166c6a2a.zip
Parentfc9b2e458008205f6914aade0cfc850113705270 (diff)
Autocommit at 14.06.2022 @ 14:44
2 files changed, 8 insertions, 55 deletions
-rw-r--r--src/Generic/List/OrderedList.hpp55
-rw-r--r--src/Generic/Pair/Pair.hpp8
diff --git a/src/Generic/List/OrderedList.hpp b/src/Generic/List/OrderedList.hpp
deleted file mode 100644
index 8d13a5d..0000000
--- a/src/Generic/List/OrderedList.hpp
+++ /dev/null
@@ -1,55 +0,0 @@
-#ifndef HEADER_ORDEREDLIST
-#define HEADER_ORDEREDLIST
-
-/*! \file OrderedList.hpp
- * \brief Stores declaration and definition of templated class OrderedList
- */
-
-#include "List.hpp"
-
-/*! \brief Inherits List, but contains it's elements in a sorted manner
- *
- * \warning Outside those defined in List, insert() requires the type to have defined a "compare" of functions.
- * \sa insert()
- */
-template <typename T>
-class OrderedList : public List<T> {
-public:
- OrderedList();
- OrderedList(const T* elements, unsigned elementsCount);
-
- /*! \brief \warning Function is deleted, use insert() instead
- * \sa insert()
- */
- void add(T element) = delete;
- /*! \brief \warning Function is deleted, use insert() instead
- * \sa insert()
- */
- void insertAt(T element, unsigned index) = delete;
-
- //! Inserts an element at a sorted position
- void insert(T element);
-};
-
-template <typename T>
-OrderedList<T>::OrderedList() : OrderedList(nullptr, 0) {}
-
-template <typename T>
-OrderedList<T>::OrderedList(const T* elements, unsigned elementsCount) : List<T>::List(elements, elementsCount) {}
-
-/*!
- * \warning The function depends on the type having a function "compare" defined, which takes two elements and returns a number <0 if elem1 < elem2, >0 if elem1 > elem2, 0 if elem1 == elem2
- * \note Insertion is done linearly
- */
-template <typename T>
-void OrderedList<T>::insert(T element) {
- if (List<T>::length == List<T>::count) List<T>::resize();
-
- unsigned insertionInd = 0;
- while (insertionInd < List<T>::count && List<T>::elements[insertionInd].compare(element) < 0)
- insertionInd++;
-
- List<T>::insertAt(element, insertionInd);
-}
-
-#endif
diff --git a/src/Generic/Pair/Pair.hpp b/src/Generic/Pair/Pair.hpp
index 0238130..64614ca 100644
--- a/src/Generic/Pair/Pair.hpp
+++ b/src/Generic/Pair/Pair.hpp
@@ -1,6 +1,14 @@
#ifndef PAIR
#define PAIR
+/*! \file Pair.hpp
+ * \brief Stores the declaration of struct Pair
+ */
+
+/*! \brief Stores two values of any types
+ *
+ * Values are public, so no explicit getters or setters are made.
+ */
template <typename T, typename U>
struct Pair {
T left;