From fd96738eca7dc262616e73bb00d4abed7b975497 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sat, 7 May 2022 11:07:45 +0300 Subject: Autocommit at 07.05.2022 @ 11:07 --- src/Generic/List/List.hpp | 8 ++++---- src/Generic/List/OrderedList.hpp | 8 ++++---- src/Services/HallService.cpp | 4 ++++ 3 files changed, 12 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/Generic/List/List.hpp b/src/Generic/List/List.hpp index 7088f2e..c798590 100644 --- a/src/Generic/List/List.hpp +++ b/src/Generic/List/List.hpp @@ -17,8 +17,8 @@ protected: public: List(const T* elements, unsigned elementsCount); - void add(const T& element); - void insertAt(const T& element, unsigned index); + void add(T element); + void insertAt(T element, unsigned index); bool removeAt(unsigned index); unsigned findIndex(const T& element) const; bool contain(const T& element) const; @@ -78,14 +78,14 @@ List::List(const T* elements, unsigned elementsCount) { } template -void List::add(const T& element) { +void List::add(T element) { if (length == count) resize(); elements[count++] = element; } template -void List::insertAt(const T& element, unsigned index) { +void List::insertAt(T element, unsigned index) { if (index >= count) add(element); if (length == count) resize(); diff --git a/src/Generic/List/OrderedList.hpp b/src/Generic/List/OrderedList.hpp index 4396d33..83fb68a 100644 --- a/src/Generic/List/OrderedList.hpp +++ b/src/Generic/List/OrderedList.hpp @@ -9,10 +9,10 @@ public: OrderedList(); OrderedList(const T* elements, unsigned elementsCount); - void add(const T& element) = delete; - void insertAt(const T& element, unsigned index) = delete; + void add(T element) = delete; + void insertAt(T element, unsigned index) = delete; - void insert(const T& element); + void insert(T element); // unsigned findIndex(const T& element) const; TODO: binary search }; @@ -23,7 +23,7 @@ template OrderedList::OrderedList(const T* elements, unsigned elementsCount) : List::List(elements, elementsCount) {} template -void OrderedList::insert(const T& element) { +void OrderedList::insert(T element) { if (List::length == List::count) List::resize(); unsigned insertionInd = 0; diff --git a/src/Services/HallService.cpp b/src/Services/HallService.cpp index 0bc8a22..ffbf989 100644 --- a/src/Services/HallService.cpp +++ b/src/Services/HallService.cpp @@ -3,3 +3,7 @@ HallService::HallService(const Hall* halls, unsigned hallCount) { this->halls = OrderedList(halls, hallCount); } + +const OrderedList& HallService::get_halls() const { + return halls; +} -- cgit v1.3.1-26-gb76a