ORIGINAL
Loading...
Searching...
No Matches
set.h
1#ifndef SET_H
2#define SET_H
3
4
5#include "allocator.h"
6#include "container.h"
7#include "comparator.h"
8
9namespace original {
10 template <typename K_TYPE, typename COMP = increaseComparator<K_TYPE>, typename ALLOC = allocator<K_TYPE>>
11 class set : public container<K_TYPE, ALLOC> {
12 protected:
13 COMP compare;
14
15 explicit set(COMP comp = COMP{}, ALLOC alloc = ALLOC{});
16 public:
17 virtual bool add(const K_TYPE& e) = 0;
18
19 virtual bool remove(const K_TYPE& e) = 0;
20
21 ~set() override;
22 };
23}
24
25template<typename K_TYPE, typename COMP, typename ALLOC>
26original::set<K_TYPE, COMP, ALLOC>::set(COMP comp, ALLOC alloc)
27 : container<K_TYPE, ALLOC>(std::move(alloc)), compare(std::move(comp)) {}
28
29template<typename K_TYPE, typename COMP, typename ALLOC>
30original::set<K_TYPE, COMP, ALLOC>::~set() = default;
31
32#endif //SET_H
Memory allocation interface and implementations.
container(ALLOC alloc=ALLOC{})
Constructs a container with specified allocator.
Definition container.h:129
Comparator base class and concrete comparator classes.
Abstract base class for container types.
Main namespace for the project Original.
Definition algorithms.h:21