14 template <
typename T,
typename TLess = std::less<T>>
23 for (
const T& value : list) {
50 while (from < to && from != mid) {
51 mid = (from + to) / 2;
52 if (less(data[mid], value)) {
54 }
else if (less(value, data[mid])) {
61 data.
insert(from, std::forward<U>(value));
65 template <
typename TIter>
66 void insert(TIter first, TIter last) {
68 std::sort(data.
begin(), data.
end(), TLess{});
77 auto iter = std::lower_bound(data.
begin(), data.
end(), value);
78 if (iter != data.
end() && *iter == value) {
90 return this->
find(value) != this->
end();
96 return data.
begin() + idx;
132 return std::move(data);
136 INLINE bool less(
const T& t1,
const T& t2)
const {
137 return TLess::operator()(t1, t2);
Generic dynamically allocated resizable storage.
uint32_t Size
Integral type used to index arrays (by default).
#define INLINE
Macros for conditional compilation based on selected compiler.
#define NAMESPACE_SPH_END
Wrapper of type value of which may or may not be present.
Object providing safe access to continuous memory of data.
Generic dynamically allocated resizable storage.
void reserve(const TCounter newMaxSize)
Allocates enough memory to store the given number of elements.
INLINE Iterator< StorageType > end() noexcept
void remove(const TCounter idx)
Removes an element with given index from the array.
void insert(const TCounter position, U &&value)
Inserts a new element to given position in the array.
void clear()
Removes all elements from the array, but does NOT release the memory.
INLINE TCounter size() const noexcept
INLINE bool empty() const noexcept
INLINE Iterator< StorageType > begin() noexcept
INLINE T & operator[](const Size idx)
void insert(TIter first, TIter last)
bool contains(const T &value)
Iterator< T > erase(Iterator< T > pos)
const Array< T > & array() const &
FlatSet(std::initializer_list< T > list)
INLINE bool empty() const
INLINE const T & operator[](const Size idx) const
Iterator< const T > find(const T &value) const
Iterator< T > find(const T &value)
Iterator< const T > end() const
Iterator< const T > begin() const
void reserve(const Size capacity)
Simple (forward) iterator over continuous array of objects of type T.
Object with deleted copy constructor and copy operator.