12#include "platforms/assert_defs.h"
27template <
typename Key,
typename Value,
28 typename Less = fl::less<Key>>
105 if (it !=
end() && !
mLess(key, it->first) && !
mLess(it->first, key)) {
110 FASTLED_ASSERT(success,
"Insert failed in flat_map::operator[]");
118 if (it !=
end() && !
mLess(key, it->first) && !
mLess(it->first, key)) {
122 FASTLED_ASSERT(
false,
"Key not found in flat_map");
123 return mData.front().second;
128 if (it !=
end() && !
mLess(key, it->first) && !
mLess(it->first, key)) {
131 FASTLED_ASSERT(
false,
"Key not found in flat_map");
132 return mData.front().second;
138 if (it !=
end() && !
mLess(key, it->first) && !
mLess(it->first, key)) {
146 if (it !=
end() && !
mLess(key, it->first) && !
mLess(it->first, key)) {
153 return find(key) !=
end() ? 1 : 0;
174 if (
mLess(it->first, key)) {
192 if (
mLess(it->first, key)) {
210 if (!
mLess(key, it->first)) {
228 if (!
mLess(key, it->first)) {
266 auto key =
value.first;
268 if (it !=
end() && !
mLess(key, it->first) && !
mLess(it->first, key)) {
291 if (it !=
end() && !
mLess(key, it->first) && !
mLess(it->first, key)) {
307 if (it !=
end() && !
mLess(key_copy, it->first) && !
mLess(it->first, key_copy)) {
321 template <
typename... Args>
327 template <
typename... Args>
352 fl::size
count = last - first;
355 for (fl::size i = 0; i <
count &&
pos !=
end(); ++i) {
380 mData.swap(other.mData);
391 FASTLED_ASSERT(!
empty(),
"flat_map::front() on empty map");
392 return mData.front();
396 FASTLED_ASSERT(!
empty(),
"flat_map::front() on empty map");
397 return mData.front();
401 FASTLED_ASSERT(!
empty(),
"flat_map::back() on empty map");
406 FASTLED_ASSERT(!
empty(),
"flat_map::back() on empty map");
425 *out_value = it->second;
471 *next_key = it->first;
473 }
else if (allow_rollover && !
empty()) {
474 *next_key =
begin()->first;
487 *prev_key = it->first;
489 }
else if (allow_rollover && !
empty()) {
490 *prev_key =
mData.back().first;
504 mData.shrink_to_fit();
511template <
typename Key,
typename Value,
typename Less>
514 return lhs.size() == rhs.size() &&
515 fl::equal(lhs.begin(), lhs.end(), rhs.begin());
518template <
typename Key,
typename Value,
typename Less>
521 return !(lhs == rhs);
524template <
typename Key,
typename Value,
typename Less>
528 rhs.begin(), rhs.end());
531template <
typename Key,
typename Value,
typename Less>
537template <
typename Key,
typename Value,
typename Less>
543template <
typename Key,
typename Value,
typename Less>
550template <
typename Key,
typename Value,
typename Less>
bool insert(Key &&key, Value &&value, insert_result *result=nullptr) FL_NOEXCEPT
size_type size() const FL_NOEXCEPT
void reserve(size_type n) FL_NOEXCEPT
const_reverse_iterator rend() const FL_NOEXCEPT
fl::pair< iterator, bool > insert_or_update(const Key &key, const Value &value) FL_NOEXCEPT
flat_map(memory_resource *resource) FL_NOEXCEPT
fl::pair< iterator, bool > emplace(Args &&... args) FL_NOEXCEPT
void shrink_to_fit() FL_NOEXCEPT
bool full() const FL_NOEXCEPT
bool contains(const Key &key) const FL_NOEXCEPT
const_iterator end() const FL_NOEXCEPT
bool prev(const Key &key, Key *prev_key, bool allow_rollover=false) const FL_NOEXCEPT
Value get(const Key &key, const Value &defaultValue) const FL_NOEXCEPT
typename vector_type::reverse_iterator reverse_iterator
typename vector_type::iterator iterator
fl::pair< const_iterator, const_iterator > equal_range(const Key &key) const FL_NOEXCEPT
bool update(const Key &key, const Value &value) FL_NOEXCEPT
const_iterator upper_bound(const Key &key) const FL_NOEXCEPT
typename vector_type::const_reverse_iterator const_reverse_iterator
flat_map & operator=(flat_map &&other) FL_NOEXCEPT
const_iterator find(const Key &key) const FL_NOEXCEPT
flat_map(const Less &less) FL_NOEXCEPT
const_iterator begin() const FL_NOEXCEPT
flat_map & operator=(const flat_map &other)=default
bool update(const Key &key, Value &&value) FL_NOEXCEPT
size_type max_size() const FL_NOEXCEPT
iterator insert(const_iterator, const value_type &value) FL_NOEXCEPT
const_iterator lower_bound(const Key &key) const FL_NOEXCEPT
key_compare key_comp() const FL_NOEXCEPT
const value_type & const_reference
size_type count(const Key &key) const FL_NOEXCEPT
flat_map(flat_map &&other) FL_NOEXCEPT
fl::pair< int, FxPtr > value_type
bool insert(const Key &key, const Value &value, insert_result *result=nullptr) FL_NOEXCEPT
iterator lower_bound(const Key &key) FL_NOEXCEPT
iterator erase(const_iterator pos) FL_NOEXCEPT
memory_resource * get_memory_resource() const FL_NOEXCEPT
size_type capacity() const FL_NOEXCEPT
const Value & at(const Key &key) const FL_NOEXCEPT
const value_type & back() const FL_NOEXCEPT
reverse_iterator rend() FL_NOEXCEPT
value_type & front() FL_NOEXCEPT
value_type & back() FL_NOEXCEPT
const_iterator cend() const FL_NOEXCEPT
iterator begin() FL_NOEXCEPT
bool next(const int &key, int *next_key, bool allow_rollover=false) const FL_NOEXCEPT
fl::pair< iterator, bool > insert(value_type &&value) FL_NOEXCEPT
size_type erase(const Key &key) FL_NOEXCEPT
fl::pair< iterator, iterator > equal_range(const Key &key) FL_NOEXCEPT
const value_type & front() const FL_NOEXCEPT
iterator end() FL_NOEXCEPT
bool get(const Key &key, Value *out_value) const FL_NOEXCEPT
const_iterator cbegin() const FL_NOEXCEPT
Value & operator[](const Key &key) FL_NOEXCEPT
iterator emplace_hint(const_iterator hint, Args &&... args) FL_NOEXCEPT
reverse_iterator rbegin() FL_NOEXCEPT
iterator find(const Key &key) FL_NOEXCEPT
typename vector_type::const_iterator const_iterator
flat_map(const flat_map &other) FL_NOEXCEPT
const value_type * const_pointer
iterator erase(iterator pos) FL_NOEXCEPT
iterator erase(const_iterator first, const_iterator last) FL_NOEXCEPT
fl::vector< value_type > vector_type
bool has(const Key &key) const FL_NOEXCEPT
fl::less< int > key_compare
Value & at(const Key &key) FL_NOEXCEPT
void swap(flat_map &other) FL_NOEXCEPT
iterator upper_bound(const Key &key) FL_NOEXCEPT
iterator insert(const_iterator, value_type &&value) FL_NOEXCEPT
const_reverse_iterator rbegin() const FL_NOEXCEPT
ptrdiff_t difference_type
fl::pair< iterator, bool > insert(const value_type &value) FL_NOEXCEPT
bool empty() const FL_NOEXCEPT
flat_map(const Less &less, memory_resource *resource) FL_NOEXCEPT
Polymorphic memory resource base class (PMR-style).
const value_type * const_iterator
PMR-style polymorphic memory resource for type-erased allocation.
constexpr T && forward(typename remove_reference< T >::type &t) FL_NOEXCEPT
constexpr remove_reference< T >::type && move(T &&t) FL_NOEXCEPT
void swap(T &a, T &b) FL_NOEXCEPT
constexpr int type_rank< T >::value
bool lexicographical_compare(Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2) FL_NOEXCEPT
FASTLED_FORCE_INLINE bool operator!=(const CRGB &lhs, const CRGB &rhs) FL_NOEXCEPT
Check if two CRGB objects do not have the same color data.
bool equal(Iterator1 first1, Iterator1 last1, Iterator2 first2) FL_NOEXCEPT
void swap(array< T, N > &lhs, array< T, N > &rhs) FL_NOEXCEPT
FASTLED_FORCE_INLINE bool operator<(const CRGB &lhs, const CRGB &rhs) FL_NOEXCEPT
Check if the sum of the color channels in one CRGB object is less than another.
FASTLED_FORCE_INLINE bool operator==(const CRGB &lhs, const CRGB &rhs) FL_NOEXCEPT
Check if two CRGB objects have the same color data.
FASTLED_FORCE_INLINE bool operator>(const CRGB &lhs, const CRGB &rhs) FL_NOEXCEPT
Check if the sum of the color channels in one CRGB object is greater than another.
expected< T, E > result
Alias for expected (Rust-style naming)
FASTLED_FORCE_INLINE bool operator<=(const CRGB &lhs, const CRGB &rhs) FL_NOEXCEPT
Check if the sum of the color channels in one CRGB object is less than or equal to another.
constexpr enable_if< is_fixed_point< T >::value, T >::type step(T edge, T x) FL_NOEXCEPT
FASTLED_FORCE_INLINE bool operator>=(const CRGB &lhs, const CRGB &rhs) FL_NOEXCEPT
Check if the sum of the color channels in one CRGB object is greater than or equal to another.
Base definition for an LED controller.
Binary function object that returns whether the first argument is less than the second.