MCPcopy Create free account
hub / github.com/FastLED/FastLED / flat_map

Class flat_map

src/fl/stl/flat_map.h:29–508  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27template <typename Key, typename Value,
28 typename Less = fl::less<Key>>
29class flat_map {
30 public:
31 enum insert_result { inserted = 0, exists = 1, at_capacity = 2 };
32
33 using key_type = Key;
34 using mapped_type = Value;
35 using value_type = fl::pair<Key, Value>;
36 using size_type = fl::size;
37 using difference_type = ptrdiff_t;
38 using key_compare = Less;
39 using reference = value_type&;
40 using const_reference = const value_type&;
41 using pointer = value_type*;
42 using const_pointer = const value_type*;
43
44 using vector_type = fl::vector<value_type>;
45 using iterator = typename vector_type::iterator;
46 using const_iterator = typename vector_type::const_iterator;
47 using reverse_iterator = typename vector_type::reverse_iterator;
48 using const_reverse_iterator = typename vector_type::const_reverse_iterator;
49
50 private:
51 vector_type mData;
52 Less mLess;
53
54 public:
55 // Constructors
56 flat_map() = default;
57
58 explicit flat_map(memory_resource* resource) FL_NOEXCEPT
59 : mData(resource) {}
60
61 explicit flat_map(const Less& less) FL_NOEXCEPT
62 : mLess(less) {}
63
64 flat_map(const Less& less, memory_resource* resource) FL_NOEXCEPT
65 : mData(resource), mLess(less) {}
66
67 flat_map(const flat_map& other) FL_NOEXCEPT
68 : mData(other.mData), mLess(other.mLess) {}
69 flat_map& operator=(const flat_map& other) = default;
70
71 flat_map(flat_map&& other) FL_NOEXCEPT
72 : mData(fl::move(other.mData)), mLess(fl::move(other.mLess)) {}
73
74 flat_map& operator=(flat_map&& other) FL_NOEXCEPT {
75 if (this != &other) {
76 mData = fl::move(other.mData);
77 mLess = fl::move(other.mLess);
78 }
79 return *this;
80 }
81
82 // Iterators
83 iterator begin() FL_NOEXCEPT { return mData.begin(); }
84 iterator end() FL_NOEXCEPT { return mData.end(); }
85 const_iterator begin() const FL_NOEXCEPT { return mData.begin(); }
86 const_iterator end() const FL_NOEXCEPT { return mData.end(); }

Callers

nothing calls this directly

Calls 13

ValueEnum · 0.85
lower_boundFunction · 0.70
endFunction · 0.70
findFunction · 0.70
emptyFunction · 0.70
beginMethod · 0.45
endMethod · 0.45
rbeginMethod · 0.45
rendMethod · 0.45
insertMethod · 0.45
frontMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected