Iros
 
Loading...
Searching...
No Matches
map_interface.h
Go to the documentation of this file.
1#pragma once
2
10#include "di/math/to_unsigned.h"
11#include "di/meta/compare.h"
12#include "di/meta/relation.h"
13#include "di/util/clone.h"
17
18namespace di::container {
19template<typename Self, typename Value, typename Key, typename Val, typename Iterator, typename ConstIterator,
20 template<typename> typename ValidForLookup, bool is_multi>
22private:
23 template<typename T>
24 constexpr static bool valid = ValidForLookup<T>::value;
25
26 constexpr auto self() -> Self& { return static_cast<Self&>(*this); }
27 constexpr auto self() const -> Self const& { return static_cast<Self const&>(*this); }
28
29 constexpr auto unconst_iterator(ConstIterator it) -> Iterator { return self().unconst_iterator(util::move(it)); }
30
31 constexpr auto begin() -> Iterator { return self().begin(); }
32 constexpr auto end() -> Iterator { return self().end(); }
33
34 constexpr auto begin() const -> ConstIterator { return self().begin(); }
35 constexpr auto end() const -> ConstIterator { return self().end(); }
36
37 constexpr auto size() const -> size_t { return self().size(); }
38
39 template<concepts::ContainerCompatible<Value> Con, typename... Args>
40 requires(concepts::ConstructibleFrom<Self, Args...>)
42 Args&&... args) {
43 auto result = Self(util::forward<Args>(args)...);
44 result.insert_container(util::forward<Con>(container));
45 return result;
46 }
47
48public:
49 constexpr auto empty() const -> bool { return size() == 0; }
50
51 constexpr void clear() { erase(begin(), end()); }
52
53 constexpr auto operator[](Key const& needle) -> decltype(auto)
55 {
56 return as_fallible(this->try_emplace(needle)) % [&](auto result) {
57 return util::ref(util::get<1>(*util::get<0>(result)));
59 }
60
61 constexpr auto operator[](Key&& needle) -> decltype(auto)
62 requires(!is_multi && concepts::DefaultConstructible<Val>)
63 {
64 return as_fallible(this->try_emplace(util::move(needle))) % [&](auto result) {
65 return util::ref(util::get<1>(*util::get<0>(result)));
67 }
68
69 template<typename K>
71 constexpr auto operator[](K&& needle) -> decltype(auto) {
72 return as_fallible(this->try_emplace(util::forward<K>(needle))) % [&](auto result) {
73 return util::ref(util::get<1>(*util::get<0>(result)));
75 }
76
77 constexpr auto insert(Value const& value)
79 {
80 return self().insert_with_factory(value, [&] {
81 return util::clone(value);
82 });
83 }
84
85 constexpr auto insert(Value&& value) {
86 return self().insert_with_factory(value, [&] {
87 return util::move(value);
88 });
89 }
90
91 template<typename U>
92 requires(valid<U> && concepts::CreatableFrom<Value, U>)
93 constexpr auto insert(U&& value) {
94 return self().insert_with_factory(value, [&] {
95 return util::create<Value>(util::forward<U>(value));
96 });
97 }
98
99 constexpr auto insert(ConstIterator hint, Value const& value)
101 {
102 return self().insert_with_factory(hint, value, [&] {
103 return util::clone(value);
104 });
105 }
106
107 constexpr auto insert(ConstIterator hint, Value&& value) {
108 return self().insert_with_factory(hint, value, [&] {
109 return util::move(value);
110 });
111 }
112
113 template<typename U>
114 requires(valid<U> && concepts::CreatableFrom<Value, U>)
115 constexpr auto insert(ConstIterator hint, U&& value) {
116 return self().insert_with_factory(hint, value, [&] {
117 return util::create<Value>(util::forward<U>(value));
118 });
119 }
120
121 template<typename U>
123 constexpr auto insert_or_assign(Key const& needle, U&& value) {
124 bool did_insert = false;
125 return as_fallible(self().insert_with_factory(
126 needle,
127 [&] {
128 did_insert = true;
129 return as_fallible(util::clone(needle)) % [&](Key&& key) {
130 return as_fallible(util::create<Val>(util::forward<U>(value))) % [&](Val&& value) {
131 return Value(util::move(key), util::move(value));
132 };
133 } | try_infallible;
134 })) |
135 if_success([&](auto&& result) {
136 if (!did_insert) {
137 util::get<1>(*util::get<0>(result)) = Val(util::forward<U>(value));
138 }
139 }) |
141 }
142
143 template<typename U>
144 requires(!is_multi && concepts::CreatableFrom<Val, U>)
145 constexpr auto insert_or_assign(Key&& needle, U&& value) {
146 bool did_insert = false;
147 return as_fallible(self().insert_with_factory(
148 needle,
149 [&] {
150 did_insert = true;
151 return as_fallible(util::create<Val>(util::forward<U>(value))) % [&](Val&& value) {
152 return Value(util::move(needle), util::move(value));
153 } | try_infallible;
154 })) |
155 if_success([&](auto&& result) {
156 if (!did_insert) {
157 util::get<1>(*util::get<0>(result)) = Val(util::forward<U>(value));
158 }
159 }) |
161 }
162
163 template<typename K, typename U>
164 requires(!is_multi && valid<K> && concepts::CreatableFrom<Key, K> && concepts::CreatableFrom<Val, U>)
165 constexpr auto insert_or_assign(K&& needle, U&& value) {
166 bool did_insert = false;
167 return as_fallible(self().insert_with_factory(
168 needle,
169 [&] {
170 did_insert = true;
171 return as_fallible(util::create<Key>(needle)) % [&](Key&& key) {
172 return as_fallible(util::create<Val>(util::forward<U>(value))) % [&](Val&& value) {
173 return Value(util::move(key), util::move(value));
174 } | try_infallible;
175 } | try_infallible;
176 })) |
177 if_success([&](auto&& result) {
178 if (!did_insert) {
179 util::get<1>(*util::get<0>(result)) = Val(util::forward<U>(value));
180 }
181 }) |
183 }
184
185 template<typename U>
187 constexpr auto insert_or_assign(ConstIterator hint, Key const& needle, U&& value) {
188 bool did_insert = false;
189 return as_fallible(self().insert_with_factory(
190 hint, needle,
191 [&] {
192 did_insert = true;
193 return as_fallible(util::clone(needle)) % [&](Key&& key) {
194 return as_fallible(util::create<Val>(util::forward<U>(value))) % [&](Val&& value) {
195 return Value(util::move(key), util::move(value));
196 };
197 } | try_infallible;
198 })) |
199 if_success([&](auto&& result) {
200 if (!did_insert) {
201 util::get<1>(*result) = Val(util::forward<U>(value));
202 }
203 }) |
205 }
206
207 template<typename U>
208 requires(!is_multi && concepts::CreatableFrom<Val, U>)
209 constexpr auto insert_or_assign(ConstIterator hint, Key&& needle, U&& value) {
210 bool did_insert = false;
211 return as_fallible(self().insert_with_factory(
212 hint, needle,
213 [&] {
214 did_insert = true;
215 return as_fallible(util::create<Val>(util::forward<U>(value))) % [&](Val&& value) {
216 return Value(util::move(needle), util::move(value));
217 } | try_infallible;
218 })) |
219 if_success([&](auto&& result) {
220 if (!did_insert) {
221 util::get<1>(*result) = Val(util::forward<U>(value));
222 }
223 }) |
225 }
226
227 template<typename K, typename U>
228 requires(!is_multi && valid<K> && concepts::CreatableFrom<Key, K> && concepts::CreatableFrom<Val, U>)
229 constexpr auto insert_or_assign(ConstIterator, K&& needle, U&& value) {
230 bool did_insert = false;
231 return as_fallible(self().insert_with_factory(
232 needle,
233 [&] {
234 did_insert = true;
235 return as_fallible(util::create<Key>(needle)) >> [&](Key&& key) {
236 return as_fallible(util::create<Val>(util::forward<U>(value))) % [&](Val&& value) {
237 return Value(util::move(key), util::move(value));
238 };
239 } | try_infallible;
240 })) |
241 if_success([&](auto&& result) {
242 if (!did_insert) {
243 util::get<1>(*result) = Val(util::forward<U>(value));
244 }
245 }) |
247 }
248
249 template<typename... Args>
250 requires(!is_multi && concepts::Clonable<Key> && concepts::CreatableFrom<Val, Args...>)
251 constexpr auto try_emplace(Key const& needle, Args&&... args) {
252 return self().insert_with_factory(needle, [&] {
253 return as_fallible(util::clone(needle)) >> [&](Key&& key) {
254 return as_fallible(util::create<Val>(util::forward<Args>(args)...)) % [&](Val&& value) {
255 return Value(util::move(key), util::move(value));
256 };
257 } | try_infallible;
258 });
259 }
260
261 template<typename... Args>
262 requires(!is_multi && concepts::CreatableFrom<Val, Args...>)
263 constexpr auto try_emplace(Key&& needle, Args&&... args) {
264 return self().insert_with_factory(needle, [&] {
265 return as_fallible(util::create<Val>(util::forward<Args>(args)...)) % [&](Val&& value) {
266 return Value(util::move(needle), util::move(value));
267 } | try_infallible;
268 });
269 }
270
271 template<typename K, typename... Args>
272 requires(!is_multi && concepts::CreatableFrom<Key, K> && concepts::CreatableFrom<Val, Args...>)
273 constexpr auto try_emplace(K&& needle, Args&&... args) {
274 return self().insert_with_factory(needle, [&] {
275 return as_fallible(util::create<Key>(util::forward<K>(needle))) >> [&](Key&& key) {
276 return as_fallible(util::create<Val>(util::forward<Args>(args)...)) % [&](Val&& value) {
277 return Value(util::move(key), util::move(value));
278 };
279 } | try_infallible;
280 });
281 }
282
283 template<typename... Args>
284 requires(!is_multi && concepts::Clonable<Key> && concepts::CreatableFrom<Val, Args...>)
285 constexpr auto try_emplace(ConstIterator hint, Key const& needle, Args&&... args) {
286 return self().insert_with_factory(hint, needle, [&] {
287 return as_fallible(util::clone(needle)) >> [&](Key&& key) {
288 return as_fallible(util::create<Val>(util::forward<Args>(args)...)) % [&](Val&& value) {
289 return Value(util::move(key), util::move(value));
290 };
291 } | try_infallible;
292 });
293 }
294
295 template<typename... Args>
296 requires(!is_multi && concepts::CreatableFrom<Val, Args...>)
297 constexpr auto try_emplace(ConstIterator hint, Key&& needle, Args&&... args) {
298 return self().insert_with_factory(hint, needle, [&] {
299 return as_fallible(util::create<Val>(util::forward<Args>(args)...)) % [&](Val&& value) {
300 return Value(util::move(needle), util::move(value));
301 } | try_infallible;
302 });
303 }
304
305 template<typename K, typename... Args>
306 requires(!is_multi && concepts::CreatableFrom<Key, K> && concepts::CreatableFrom<Val, Args...>)
307 constexpr auto try_emplace(ConstIterator hint, K&& needle, Args&&... args) {
308 return self().insert_with_factory(hint, needle, [&] {
309 return as_fallible(util::create<Key>(util::forward<K>(needle))) >> [&](Key&& key) {
310 return as_fallible(util::create<Val>(util::forward<Args>(args)...)) % [&](Val&& value) {
311 return Value(util::move(key), util::move(value));
312 };
313 } | try_infallible;
314 });
315 }
316
317 template<typename... Args>
318 requires(concepts::ConstructibleFrom<Value, Args...>)
319 constexpr auto emplace(Args&&... args) {
320 return insert(Value(util::forward<Args>(args)...));
321 }
322
323 template<typename... Args>
324 requires(concepts::ConstructibleFrom<Value, Args...>)
325 constexpr auto emplace_hint(ConstIterator hint, Args&&... args) {
326 return insert(hint, Value(util::forward<Args>(args)...));
327 }
328
329 template<concepts::ContainerCompatible<Value> Con>
330 constexpr auto insert_container(Con&& container) {
331 if constexpr (concepts::Expected<decltype(insert(*container::begin(container)))>) {
332 auto temp_container = Self {};
333 return container::sequence(util::forward<Con>(container),
334 [&]<typename X>(X&& value) {
335 return temp_container.insert(util::forward<X>(value));
336 }) >>
337 [&] {
338 return invoke_as_fallible([&] {
339 return self().merge_impl(util::move(temp_container));
340 });
341 };
342 } else {
343 auto first = container::begin(container);
344 auto last = container::end(container);
345 for (; first != last; ++first) {
346 insert(*first);
347 }
348 }
349 }
350
351 template<concepts::ContainerCompatible<Value> Con>
352 constexpr void insert_container(ConstIterator hint, Con&& container) {
353 if constexpr (concepts::Expected<decltype(insert(hint, *container::begin(container)))>) {
354 return insert_container(util::forward<Con>(container));
355 } else {
356 auto first = container::begin(container);
357 auto last = container::end(container);
358 for (; first != last; ++first) {
359 hint = insert(hint, *first);
360 }
361 }
362 }
363
364 constexpr auto merge(Self& self) { return self().merge_impl(util::move(self)); }
365 constexpr auto merge(Self&& self) { return self().merge_impl(util::move(self)); }
366
367 constexpr auto erase(Iterator position) { return self().erase_impl(util::move(position)); }
368
369 constexpr auto erase(Iterator first, Iterator last) -> Iterator {
370 while (first != last) {
371 first = self().erase_impl(first);
372 }
373 return last;
374 }
375
376 constexpr auto erase(Key const& needle) -> size_t {
377 if constexpr (!is_multi) {
378 auto it = this->find(needle);
379 if (it == end()) {
380 return 0;
381 }
382 self().erase_impl(util::move(it));
383 return 1;
384 } else {
385 auto [first, last] = this->equal_range(needle);
386 size_t result = 0;
387 for (; first != last; ++result) {
388 first = self().erase_impl(first);
389 }
390 return result;
391 }
392 }
393
394 template<typename U>
395 requires(valid<U>)
396 constexpr auto erase(U&& needle) -> size_t {
397 if constexpr (!is_multi) {
398 auto it = this->find(needle);
399 if (it == end()) {
400 return 0;
401 }
402 self().erase_impl(util::move(it));
403 return 1;
404 } else {
405 auto [first, last] = this->equal_range(needle);
406 size_t result = 0;
407 for (; first != last; ++result) {
408 first = self().erase_impl(first);
409 }
410 return result;
411 }
412 }
413
414 constexpr auto front() -> Optional<Value&> {
415 return lift_bool(!empty()) % [&] {
416 return util::ref(*begin());
417 };
418 }
419 constexpr auto front() const -> Optional<Value const&> {
420 return lift_bool(!empty()) % [&] {
421 return util::cref(*begin());
422 };
423 }
424
425 constexpr auto back() -> Optional<Value&> {
426 return lift_bool(!empty()) % [&] {
427 return util::ref(*container::prev(end()));
428 };
429 }
430 constexpr auto back() const -> Optional<Value const&> {
431 return lift_bool(!empty()) % [&] {
432 return util::cref(*container::prev(end()));
433 };
434 }
435
436 constexpr auto at(Key const& needle) -> Optional<Val&> {
437 auto it = this->find(needle);
438 return lift_bool(it != end()) % [&] {
439 return util::ref(util::get<1>(*it));
440 };
441 }
442 constexpr auto at(Key const& needle) const -> Optional<Val const&> {
443 auto it = this->find(needle);
444 return lift_bool(it != end()) % [&] {
445 return util::cref(util::get<1>(*it));
446 };
447 }
448
449 template<typename U>
450 requires(valid<U>)
451 constexpr auto at(U&& needle) -> Optional<Val&> {
452 auto it = this->find(needle);
453 return lift_bool(it != end()) % [&] {
454 return util::ref(util::get<1>(*it));
455 };
456 }
457 template<typename U>
458 requires(valid<U>)
459 constexpr auto at(U&& needle) const -> Optional<Val const&> {
460 auto it = this->find(needle);
461 return lift_bool(it != end()) % [&] {
462 return util::cref(util::get<1>(*it));
463 };
464 }
465
466 constexpr auto find(Key const& needle) -> Iterator { return unconst_iterator(self().find_impl(needle)); }
467 constexpr auto find(Key const& needle) const -> ConstIterator { return self().find_impl(needle); }
468
469 template<typename U>
470 requires(valid<U>)
471 constexpr auto find(U&& needle) -> Iterator {
472 return unconst_iterator(self().find_impl(needle));
473 }
474 template<typename U>
475 requires(valid<U>)
476 constexpr auto find(U&& needle) const -> ConstIterator {
477 return self().find_impl(needle);
478 }
479
480 constexpr auto contains(Key const& needle) const -> bool { return this->find(needle) != end(); }
481 template<typename U>
482 requires(valid<U>)
483 constexpr auto contains(U&& needle) const -> bool {
484 return this->find(needle) != end();
485 }
486
487 constexpr auto count(Key const& needle) const -> size_t {
488 if constexpr (!is_multi) {
489 return this->contains(needle) ? 1 : 0;
490 } else {
492 }
493 }
494
495 template<typename U>
496 requires(valid<U>)
497 constexpr auto count(U&& needle) const -> size_t {
498 if constexpr (!is_multi) {
499 return this->contains(needle) ? 1 : 0;
500 } else {
502 }
503 }
504
505 constexpr auto equal_range(Key const& needle) {
506 if constexpr (!is_multi) {
507 auto it = this->find(needle);
508 return View<Iterator> { it, container::next(it, 1, end()) };
509 } else {
510 auto [start, last] = self().equal_range_impl(needle);
511 return View<Iterator> { unconst_iterator(util::move(start)), unconst_iterator(util::move(last)) };
512 }
513 }
514 template<typename U>
515 requires(valid<U>)
516 constexpr auto equal_range(U&& needle) {
517 if constexpr (!is_multi) {
518 auto it = this->find(needle);
519 return View<ConstIterator> { it, container::next(it, 1, end()) };
520 } else {
521 return self().equal_range_impl(needle);
522 }
523 }
524
525 constexpr auto equal_range(Key const& needle) const {
526 if constexpr (!is_multi) {
527 auto it = this->find(needle);
528 return View<ConstIterator> { it, container::next(it, 1, end()) };
529 } else {
530 return self().equal_range_impl(needle);
531 }
532 }
533 template<typename U>
534 requires(valid<U>)
535 constexpr auto equal_range(U&& needle) const {
536 if constexpr (!is_multi) {
537 auto it = this->find(needle);
538 return View<ConstIterator> { it, container::next(it, 1, end()) };
539 } else {
540 return self().equal_range_impl(needle);
541 }
542 }
543
544 constexpr auto lower_bound(Key const& needle) -> Iterator
545 requires(requires {
546 { self().lower_bound_impl(needle) } -> concepts::SameAs<ConstIterator>;
547 })
548 {
549 return unconst_iterator(self().lower_bound_impl(needle));
550 }
551 constexpr auto lower_bound(Key const& needle) const -> ConstIterator
552 requires(requires {
553 { self().lower_bound_impl(needle) } -> concepts::SameAs<ConstIterator>;
554 })
555 {
556 return self().lower_bound_impl(needle);
557 }
558
559 template<typename U>
560 requires(valid<U>)
561 constexpr auto lower_bound(U&& needle) -> Iterator
562 requires(requires {
563 { self().lower_bound_impl(needle) } -> concepts::SameAs<ConstIterator>;
564 })
565 {
566 return unconst_iterator(self().lower_bound_impl(needle));
567 }
568 template<typename U>
569 requires(valid<U>)
570 constexpr auto lower_bound(U&& needle) const -> ConstIterator
571 requires(requires {
572 { self().lower_bound_impl(needle) } -> concepts::SameAs<ConstIterator>;
573 })
574 {
575 return self().lower_bound_impl(needle);
576 }
577
578 constexpr auto upper_bound(Key const& needle) -> Iterator
579 requires(requires {
580 { self().upper_bound_impl(needle) } -> concepts::SameAs<ConstIterator>;
581 })
582 {
583 return unconst_iterator(self().upper_bound_impl(needle));
584 }
585 constexpr auto upper_bound(Key const& needle) const -> ConstIterator
586 requires(requires {
587 { self().upper_bound_impl(needle) } -> concepts::SameAs<ConstIterator>;
588 })
589 {
590 return self().upper_bound_impl(needle);
591 }
592
593 template<typename U>
594 requires(valid<U>)
595 constexpr auto upper_bound(U&& needle) -> Iterator
596 requires(requires {
597 { self().upper_bound_impl(needle) } -> concepts::SameAs<ConstIterator>;
598 })
599 {
600 return unconst_iterator(self().upper_bound_impl(needle));
601 }
602 template<typename U>
603 requires(valid<U>)
604 constexpr auto upper_bound(U&& needle) const -> ConstIterator
605 requires(requires {
606 { self().upper_bound_impl(needle) } -> concepts::SameAs<ConstIterator>;
607 })
608 {
609 return self().upper_bound_impl(needle);
610 }
611
612private:
613 template<typename F, SameAs<Tag<erase_if>> T = Tag<erase_if>>
615 constexpr friend auto tag_invoke(T, Self& self, F&& function) -> usize {
616 auto it = self.begin();
617 auto result = 0ZU;
618 while (it != self.end()) {
619 if (function(*it)) {
620 it = self.erase(it);
621 ++result;
622 } else {
623 ++it;
624 }
625 }
626 return result;
627 }
628};
629}
Definition map_interface.h:21
constexpr auto count(Key const &needle) const -> size_t
Definition map_interface.h:487
constexpr auto upper_bound(U &&needle) const -> ConstIterator requires(
Definition map_interface.h:604
constexpr auto insert(Value const &value)
Definition map_interface.h:77
constexpr auto try_emplace(ConstIterator hint, K &&needle, Args &&... args)
Definition map_interface.h:307
constexpr auto upper_bound(Key const &needle) -> Iterator requires(
Definition map_interface.h:578
constexpr auto lower_bound(U &&needle) -> Iterator requires(
Definition map_interface.h:561
constexpr void clear()
Definition map_interface.h:51
constexpr auto insert(ConstIterator hint, Value const &value)
Definition map_interface.h:99
constexpr auto at(U &&needle) const -> Optional< Val const & >
Definition map_interface.h:459
constexpr auto contains(U &&needle) const -> bool
Definition map_interface.h:483
constexpr auto insert(Value &&value)
Definition map_interface.h:85
constexpr auto equal_range(Key const &needle) const
Definition map_interface.h:525
constexpr void insert_container(ConstIterator hint, Con &&container)
Definition map_interface.h:352
constexpr auto lower_bound(Key const &needle) const -> ConstIterator requires(
Definition map_interface.h:551
constexpr auto equal_range(U &&needle)
Definition map_interface.h:516
constexpr auto insert_or_assign(ConstIterator hint, Key const &needle, U &&value)
Definition map_interface.h:187
constexpr auto at(Key const &needle) const -> Optional< Val const & >
Definition map_interface.h:442
constexpr auto insert_or_assign(Key const &needle, U &&value)
Definition map_interface.h:123
constexpr auto try_emplace(Key &&needle, Args &&... args)
Definition map_interface.h:263
constexpr auto emplace_hint(ConstIterator hint, Args &&... args)
Definition map_interface.h:325
constexpr auto insert_or_assign(Key &&needle, U &&value)
Definition map_interface.h:145
constexpr auto insert(ConstIterator hint, Value &&value)
Definition map_interface.h:107
constexpr auto upper_bound(U &&needle) -> Iterator requires(
Definition map_interface.h:595
constexpr auto erase(Iterator first, Iterator last) -> Iterator
Definition map_interface.h:369
constexpr auto try_emplace(ConstIterator hint, Key const &needle, Args &&... args)
Definition map_interface.h:285
constexpr auto insert_container(Con &&container)
Definition map_interface.h:330
constexpr auto count(U &&needle) const -> size_t
Definition map_interface.h:497
constexpr auto find(U &&needle) const -> ConstIterator
Definition map_interface.h:476
constexpr auto erase(Key const &needle) -> size_t
Definition map_interface.h:376
constexpr auto operator[](Key const &needle) -> decltype(auto) requires(!is_multi &&concepts::Clonable< Key > &&concepts::DefaultConstructible< Val >)
Definition map_interface.h:53
constexpr auto merge(Self &self)
Definition map_interface.h:364
constexpr auto merge(Self &&self)
Definition map_interface.h:365
constexpr auto contains(Key const &needle) const -> bool
Definition map_interface.h:480
constexpr auto empty() const -> bool
Definition map_interface.h:49
constexpr auto insert_or_assign(K &&needle, U &&value)
Definition map_interface.h:165
constexpr auto at(Key const &needle) -> Optional< Val & >
Definition map_interface.h:436
constexpr auto insert(ConstIterator hint, U &&value)
Definition map_interface.h:115
constexpr auto try_emplace(ConstIterator hint, Key &&needle, Args &&... args)
Definition map_interface.h:297
constexpr auto find(U &&needle) -> Iterator
Definition map_interface.h:471
constexpr auto operator[](Key &&needle) -> decltype(auto) requires(!is_multi &&concepts::DefaultConstructible< Val >)
Definition map_interface.h:61
constexpr auto insert_or_assign(ConstIterator, K &&needle, U &&value)
Definition map_interface.h:229
constexpr friend auto tag_invoke(types::Tag< util::create_in_place >, InPlaceType< Self >, Con &&container, Args &&... args)
Definition map_interface.h:41
constexpr auto back() const -> Optional< Value const & >
Definition map_interface.h:430
constexpr auto insert(U &&value)
Definition map_interface.h:93
constexpr friend auto tag_invoke(T, Self &self, F &&function) -> usize
Definition map_interface.h:615
constexpr auto erase(U &&needle) -> size_t
Definition map_interface.h:396
constexpr auto lower_bound(Key const &needle) -> Iterator requires(
Definition map_interface.h:544
constexpr auto front() -> Optional< Value & >
Definition map_interface.h:414
constexpr auto equal_range(U &&needle) const
Definition map_interface.h:535
constexpr auto find(Key const &needle) -> Iterator
Definition map_interface.h:466
constexpr auto emplace(Args &&... args)
Definition map_interface.h:319
constexpr auto upper_bound(Key const &needle) const -> ConstIterator requires(
Definition map_interface.h:585
constexpr auto insert_or_assign(ConstIterator hint, Key &&needle, U &&value)
Definition map_interface.h:209
constexpr auto front() const -> Optional< Value const & >
Definition map_interface.h:419
constexpr auto try_emplace(Key const &needle, Args &&... args)
Definition map_interface.h:251
constexpr auto equal_range(Key const &needle)
Definition map_interface.h:505
constexpr auto back() -> Optional< Value & >
Definition map_interface.h:425
constexpr auto at(U &&needle) -> Optional< Val & >
Definition map_interface.h:451
constexpr auto find(Key const &needle) const -> ConstIterator
Definition map_interface.h:467
constexpr auto try_emplace(K &&needle, Args &&... args)
Definition map_interface.h:273
constexpr auto erase(Iterator position)
Definition map_interface.h:367
constexpr auto lower_bound(U &&needle) const -> ConstIterator requires(
Definition map_interface.h:570
Definition view.h:35
Definition optional_forward_declaration.h:5
Definition clone.h:44
Definition operations.h:11
Definition create.h:10
Definition operations.h:24
Definition vocab.h:30
Definition relation.h:7
Definition core.h:114
Definition sequence.h:12
constexpr auto prev
Definition prev.h:28
constexpr auto next
Definition next.h:35
constexpr auto find
Definition find.h:35
constexpr auto sequence
Definition sequence.h:34
constexpr auto distance
Definition distance.h:44
constexpr auto erase
Definition erase.h:76
constexpr auto equal_range
Definition equal_range.h:39
constexpr auto end
Definition end.h:47
constexpr auto begin
Definition begin.h:44
constexpr auto contains
Definition contains.h:24
Definition as_bool.h:8
constexpr auto to_unsigned
Definition to_unsigned.h:16
Conditional< concepts::ConstantIterator< Iter >, Iter, container::ConstIteratorImpl< Iter > > ConstIterator
Definition const_iterator.h:8
size_t usize
Definition integers.h:33
di::meta::Decay< decltype(T)> Tag
Definition tag_invoke.h:28
constexpr auto get(T &&value) -> decltype(auto)
Definition get.h:8
constexpr auto ref
Definition reference_wrapper.h:98
constexpr auto cref
Definition reference_wrapper.h:99
constexpr auto clone
Definition clone.h:39
constexpr auto create(Args &&... args)
Definition create.h:21
constexpr auto invoke_as_fallible
Definition invoke_as_fallible.h:37
constexpr auto as_fallible
Definition as_fallible.h:26
constexpr auto try_infallible
Definition try_infallible.h:31
constexpr auto if_success
Definition if_success.h:31
constexpr auto lift_bool
Definition lift_bool.h:13
@ Self
Definition local_apic.h:126
Key
Definition key.h:8
Definition in_place_type.h:5