53 template<
typename Key,
typename T,
typename Compare = std::less<>,
typename Container = Vector<Pair<Key, T>>>
class FlatMap {
63 using pointer =
typename std::allocator_traits<allocator_type>::pointer;
64 using const_pointer =
typename std::allocator_traits<allocator_type>::pointer;
65 using iterator =
typename container_type::iterator;
70 using size_type =
typename container_type::size_type;
85 m_cmp = std::move(x.m_cmp);
134 template<
typename P> std::pair<iterator, bool>
insert(
P&&
val) {
152 template<
typename... Args> std::pair<iterator, bool>
emplace(Args&&... args) {
193 throw std::out_of_range(
"FlatMap out of range");
202 throw std::out_of_range(
"FlatMap out of range");
232 template<
typename Key,
typename T,
typename Compare,
typename Container>
237 template<
typename Key,
typename T,
typename Compare,
typename Container>
243 template<
typename Key,
typename T,
size_t Capacity,
typename Compare = std::less<>>
FlatMap is an almsot drop-in replacement of Map.
Definition FlatMap.hpp:53
FlatMap & operator=(FlatMap &&x)
Definition FlatMap.hpp:84
typename container_type::allocator_type allocator_type
Definition FlatMap.hpp:62
FlatMap & operator=(const FlatMap &x)
Definition FlatMap.hpp:79
value_type & reference
Definition FlatMap.hpp:60
FlatMap()
Definition FlatMap.hpp:72
typename std::allocator_traits< allocator_type >::pointer const_pointer
Definition FlatMap.hpp:64
const_reverse_iterator rbegin() const noexcept
Definition FlatMap.hpp:95
Key key_type
Definition FlatMap.hpp:55
typename container_type::difference_type difference_type
Definition FlatMap.hpp:69
const value_type & const_reference
Definition FlatMap.hpp:61
size_type erase(const K &k)
Definition FlatMap.hpp:160
typename container_type::reverse_iterator reverse_iterator
Definition FlatMap.hpp:67
mapped_type & operator[](K &&k)
Definition FlatMap.hpp:180
iterator find(const K &k)
Definition FlatMap.hpp:114
iterator lower_bound(const K &k)
Definition FlatMap.hpp:110
std::pair< iterator, bool > insert(P &&val)
Definition FlatMap.hpp:134
mapped_type & at(const K &k)
Definition FlatMap.hpp:190
typename container_type::const_iterator const_iterator
Definition FlatMap.hpp:66
const_iterator end() const noexcept
Definition FlatMap.hpp:93
void swap(FlatMap &x)
Definition FlatMap.hpp:208
size_type max_size() const noexcept
Definition FlatMap.hpp:103
typename container_type::const_reverse_iterator const_reverse_iterator
Definition FlatMap.hpp:68
size_type size() const noexcept
Definition FlatMap.hpp:102
FlatMap(FlatMap &&x)=default
container_type & modify_container() noexcept
Definition FlatMap.hpp:216
reverse_iterator rbegin() noexcept
Definition FlatMap.hpp:94
const_iterator begin() const noexcept
Definition FlatMap.hpp:91
typename std::allocator_traits< allocator_type >::pointer pointer
Definition FlatMap.hpp:63
size_type capacity() const noexcept
Definition FlatMap.hpp:106
const_iterator find(const K &k) const
Definition FlatMap.hpp:123
typename container_type::iterator iterator
Definition FlatMap.hpp:65
std::pair< iterator, bool > emplace(Args &&... args)
Definition FlatMap.hpp:152
pair_compare m_cmp
Definition FlatMap.hpp:228
iterator erase(const_iterator pos)
Definition FlatMap.hpp:158
const_reverse_iterator rend() const noexcept
Definition FlatMap.hpp:97
container_type m_container
Definition FlatMap.hpp:229
FlatMap(const key_compare &comp, const allocator_type &alloc=allocator_type())
Definition FlatMap.hpp:74
typename container_type::size_type size_type
Definition FlatMap.hpp:70
const_iterator lower_bound(const K &k) const
Definition FlatMap.hpp:112
iterator begin() noexcept
Definition FlatMap.hpp:90
std::pair< iterator, bool > insert(const value_type &val)
Definition FlatMap.hpp:143
const_iterator cend() const noexcept
Definition FlatMap.hpp:99
size_t count(const K &k) const
Definition FlatMap.hpp:132
mapped_type & operator[](const K &k)
Definition FlatMap.hpp:170
const container_type & container() const noexcept
Definition FlatMap.hpp:213
void clear() noexcept
Definition FlatMap.hpp:108
FlatMap(const FlatMap &x)=default
void reserve(size_type count)
Definition FlatMap.hpp:105
iterator erase(iterator pos)
Definition FlatMap.hpp:157
reverse_iterator rend() noexcept
Definition FlatMap.hpp:96
bool empty() const noexcept
Definition FlatMap.hpp:101
iterator end() noexcept
Definition FlatMap.hpp:92
Compare key_compare
Definition FlatMap.hpp:59
const mapped_type & at(const K &k) const
Definition FlatMap.hpp:199
std::pair< Key, T > value_type
Definition FlatMap.hpp:57
Container container_type
Definition FlatMap.hpp:58
const_iterator cbegin() const noexcept
Definition FlatMap.hpp:98
T mapped_type
Definition FlatMap.hpp:56
Definition Application.hpp:19
bool operator!=(const ShortAllocator< T, N, A1 > &x, const ShortAllocator< U, M, A2 > &y) noexcept
Definition Allocator.hpp:416
bool operator==(const ShortAllocator< T, N, A1 > &x, const ShortAllocator< U, M, A2 > &y) noexcept
Definition Allocator.hpp:411
constexpr CountAlgorithmFunctor count
Returns the number of elements matching an element.
Definition Count.hpp:82
constexpr FindAlgorithmFunctor find
Finds the first element equal to another element.
Definition Find.hpp:70
@ Key
The event is of type KeyEvent.
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
Definition FlatMap.hpp:219
pair_compare(const key_compare &kc)
Definition FlatMap.hpp:221
bool operator()(const K &a, const value_type &b) const
Definition FlatMap.hpp:224
bool operator()(const value_type &a, const K &b) const
Definition FlatMap.hpp:223
key_compare kcmp
Definition FlatMap.hpp:226