14#include "platforms/assert_defs.h"
29template <
typename Key,
typename Value,
30 typename Less = fl::less<Key>>
107 if (it !=
end() && !
mLess(key, it->first) && !
mLess(it->first, key)) {
138 if (it !=
end() && !
mLess(key, it->first) && !
mLess(it->first, key)) {
142 FASTLED_ASSERT(
false,
"Key not found in flat_map");
143 return mData.front().second;
148 if (it !=
end() && !
mLess(key, it->first) && !
mLess(it->first, key)) {
151 FASTLED_ASSERT(
false,
"Key not found in flat_map");
152 return mData.front().second;
158 if (it !=
end() && !
mLess(key, it->first) && !
mLess(it->first, key)) {
166 if (it !=
end() && !
mLess(key, it->first) && !
mLess(it->first, key)) {
173 return find(key) !=
end() ? 1 : 0;
191 template <
typename L = Less>
193 const L*
less =
static_cast<const L*
>(ctx);
194 const Key* ka =
static_cast<const Key*
>(a);
195 const Key* kb =
static_cast<const Key*
>(b);
196 return (*
less)(*ka, *kb);
211 return mData.begin() + idx;
217 return mData.begin() + idx;
223 return mData.begin() + idx;
229 return mData.begin() + idx;
260 auto key =
value.first;
262 if (it !=
end() && !
mLess(key, it->first) && !
mLess(it->first, key)) {
285 if (it !=
end() && !
mLess(key, it->first) && !
mLess(it->first, key)) {
301 if (it !=
end() && !
mLess(key_copy, it->first) && !
mLess(it->first, key_copy)) {
315 template <
typename... Args>
321 template <
typename... Args>
338 fl::size
count = last - first;
341 for (fl::size i = 0; i <
count &&
pos !=
end(); ++i) {
366 mData.swap(other.mData);
377 FASTLED_ASSERT(!
empty(),
"flat_map::front() on empty map");
378 return mData.front();
382 FASTLED_ASSERT(!
empty(),
"flat_map::front() on empty map");
383 return mData.front();
387 FASTLED_ASSERT(!
empty(),
"flat_map::back() on empty map");
392 FASTLED_ASSERT(!
empty(),
"flat_map::back() on empty map");
411 *out_value = it->second;
457 *next_key = it->first;
459 }
else if (allow_rollover && !
empty()) {
460 *next_key =
begin()->first;
473 *prev_key = it->first;
475 }
else if (allow_rollover && !
empty()) {
476 *prev_key =
mData.back().first;
490 mData.shrink_to_fit();
497template <
typename Key,
typename Value,
typename Less>
500 return lhs.size() == rhs.size() &&
501 fl::equal(lhs.begin(), lhs.end(), rhs.begin());
504template <
typename Key,
typename Value,
typename Less>
507 return !(lhs == rhs);
510template <
typename Key,
typename Value,
typename Less>
514 rhs.begin(), rhs.end());
517template <
typename Key,
typename Value,
typename Less>
523template <
typename Key,
typename Value,
typename Less>
529template <
typename Key,
typename Value,
typename Less>
536template <
typename Key,
typename Value,
typename Less>
static T & instance() FL_NO_EXCEPT
bool update(const Key &key, Value &&value) FL_NO_EXCEPT
iterator erase(const_iterator pos) FL_NO_EXCEPT
flat_map(flat_map &&other) FL_NO_EXCEPT
bool next(const Key &key, Key *next_key, bool allow_rollover=false) const FL_NO_EXCEPT
flat_map(const Less &less) FL_NO_EXCEPT
Value & operator[](const Key &key) FL_NO_EXCEPT
const Value & at(const Key &key) const FL_NO_EXCEPT
bool has(const Key &key) const FL_NO_EXCEPT
iterator erase(const_iterator first, const_iterator last) FL_NO_EXCEPT
bool full() const FL_NO_EXCEPT
iterator insert(const_iterator, value_type &&value) FL_NO_EXCEPT
typename vector_type::reverse_iterator reverse_iterator
iterator erase(iterator pos) FL_NO_EXCEPT
typename vector_type::iterator iterator
fl::pair< iterator, bool > insert(value_type &&value) FL_NO_EXCEPT
bool contains(const Key &key) const FL_NO_EXCEPT
reverse_iterator rend() FL_NO_EXCEPT
size_type capacity() const FL_NO_EXCEPT
typename vector_type::const_reverse_iterator const_reverse_iterator
const_iterator end() const FL_NO_EXCEPT
fl::pair< const_iterator, const_iterator > equal_range(const Key &key) const FL_NO_EXCEPT
const_iterator lower_bound(const Key &key) const FL_NO_EXCEPT
iterator upper_bound(const Key &key) FL_NO_EXCEPT
size_type max_size() const FL_NO_EXCEPT
const value_type & back() const FL_NO_EXCEPT
flat_map & operator=(const flat_map &other)=default
flat_map(const flat_map &other) FL_NO_EXCEPT
bool get(const Key &key, Value *out_value) const FL_NO_EXCEPT
key_compare key_comp() const FL_NO_EXCEPT
const_iterator cbegin() const FL_NO_EXCEPT
bool update(const Key &key, const Value &value) FL_NO_EXCEPT
const value_type & front() const FL_NO_EXCEPT
const_iterator begin() const FL_NO_EXCEPT
iterator emplace_hint(const_iterator hint, Args &&... args) FL_NO_EXCEPT
void shrink_to_fit() FL_NO_EXCEPT
static bool less_thunk(const void *ctx, const void *a, const void *b) FL_NO_EXCEPT
void reserve(size_type n) FL_NO_EXCEPT
value_type & front() FL_NO_EXCEPT
Value & at(const Key &key) FL_NO_EXCEPT
const value_type & const_reference
bool insert(const Key &key, const Value &value, insert_result *result=nullptr) FL_NO_EXCEPT
flat_map & operator=(flat_map &&other) FL_NO_EXCEPT
fl::pair< iterator, bool > insert_or_update(const Key &key, const Value &value) FL_NO_EXCEPT
iterator find(const Key &key) FL_NO_EXCEPT
fl::pair< int, FxPtr > value_type
iterator insert(const_iterator, const value_type &value) FL_NO_EXCEPT
iterator lower_bound(const Key &key) FL_NO_EXCEPT
iterator begin() FL_NO_EXCEPT
flat_map(memory_resource *resource) FL_NO_EXCEPT
size_type size() const FL_NO_EXCEPT
fl::pair< iterator, bool > emplace(Args &&... args) FL_NO_EXCEPT
const_iterator upper_bound(const Key &key) const FL_NO_EXCEPT
bool insert(Key &&key, Value &&value, insert_result *result=nullptr) FL_NO_EXCEPT
Value get(const Key &key, const Value &defaultValue) const FL_NO_EXCEPT
void clear() FL_NO_EXCEPT
bool prev(const Key &key, Key *prev_key, bool allow_rollover=false) const FL_NO_EXCEPT
size_type erase(const Key &key) FL_NO_EXCEPT
value_type & back() FL_NO_EXCEPT
bool empty() const FL_NO_EXCEPT
fl::pair< iterator, bool > insert(const value_type &value) FL_NO_EXCEPT
typename vector_type::const_iterator const_iterator
fl::pair< iterator, iterator > equal_range(const Key &key) FL_NO_EXCEPT
const value_type * const_pointer
const_iterator find(const Key &key) const FL_NO_EXCEPT
size_type count(const Key &key) const FL_NO_EXCEPT
const_reverse_iterator rend() const FL_NO_EXCEPT
detail::flat_map_ops make_ops() const FL_NO_EXCEPT
void swap(flat_map &other) FL_NO_EXCEPT
flat_map(const Less &less, memory_resource *resource) FL_NO_EXCEPT
fl::vector< value_type > vector_type
fl::less< int > key_compare
iterator end() FL_NO_EXCEPT
const_iterator cend() const FL_NO_EXCEPT
reverse_iterator rbegin() FL_NO_EXCEPT
ptrdiff_t difference_type
memory_resource * get_memory_resource() const FL_NO_EXCEPT
const_reverse_iterator rbegin() const FL_NO_EXCEPT
Polymorphic memory resource base class (PMR-style).
const value_type * const_iterator
PMR-style polymorphic memory resource for type-erased allocation.
constexpr remove_reference< T >::type && move(T &&t) FL_NO_EXCEPT
bool lexicographical_compare(Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2) FL_NO_EXCEPT
constexpr T && forward(typename remove_reference< T >::type &t) FL_NO_EXCEPT
bool equal(Iterator1 first1, Iterator1 last1, Iterator2 first2) FL_NO_EXCEPT
FL_NO_INLINE fl::size flat_map_lower_bound_idx(const void *data, fl::size n, const void *key, const flat_map_ops &ops) FL_NO_EXCEPT
FL_NO_INLINE fl::size flat_map_upper_bound_idx(const void *data, fl::size n, const void *key, const flat_map_ops &ops) FL_NO_EXCEPT
flat_map_less_thunk_t less_fn
void swap(array< T, N > &lhs, array< T, N > &rhs) FL_NO_EXCEPT
u8 u8 fract8 blur_amount FL_NO_EXCEPT
constexpr int type_rank< T >::value
FASTLED_FORCE_INLINE bool operator==(const CRGB &lhs, const CRGB &rhs) FL_NO_EXCEPT
Check if two CRGB objects have the same color data.
FASTLED_FORCE_INLINE bool operator>(const CRGB &lhs, const CRGB &rhs) FL_NO_EXCEPT
Check if the sum of the color channels in one CRGB object is greater than another.
FASTLED_FORCE_INLINE bool operator<=(const CRGB &lhs, const CRGB &rhs) FL_NO_EXCEPT
Check if the sum of the color channels in one CRGB object is less than or equal to another.
expected< T, E > result
Alias for expected (Rust-style naming)
FASTLED_FORCE_INLINE bool operator!=(const CRGB &lhs, const CRGB &rhs) FL_NO_EXCEPT
Check if two CRGB objects do not have the same color data.
FASTLED_FORCE_INLINE bool operator>=(const CRGB &lhs, const CRGB &rhs) FL_NO_EXCEPT
Check if the sum of the color channels in one CRGB object is greater than or equal to another.
FASTLED_FORCE_INLINE bool operator<(const CRGB &lhs, const CRGB &rhs) FL_NO_EXCEPT
Check if the sum of the color channels in one CRGB object is less than another.
Base definition for an LED controller.
Binary function object that returns whether the first argument is less than the second.