tnmap.hpp
Go to the documentation of this file.
1
2#pragma once
3
5#include <initializer_list>
6#include <utility>
7#include "core/builtin/container/native/smultimap.inl"
8
9namespace by {
10
11 template <typename K, typename V, typename TACTIC = strTactic> class tnmap: public tnbicontainer<K, V> {
13 BY(CLASS(tnmap, _super_))
14
15 public:
16 template <typename K1, typename V1> friend class tmap;
17 typedef tstr<V, TACTIC> wrap;
19 typedef typename cmap::iterator citer;
20 typedef std::pair<K, V> cpair;
21 typedef typename super::iter iter;
22 typedef typename super::iteration iteration;
23 friend class nmapIteration;
24#include "../iter/nmapIteration.hpp"
25
26 public:
27 tnmap();
28 tnmap(const std::initializer_list<std::pair<K, V*>>& elems);
29
30 // len:
31 ncnt len() const override;
32
33 // has:
34 using super::in;
35 nbool in(const K& key) const override;
36
37 // get:
38 using super::get;
39 V* get(const K& key) override;
40
41 // add:
42 using super::add;
43 nbool add(const K& key, const V& new1) override;
44
45 // del:
46 using super::del;
47 nbool del(const K& key) override;
48 nbool del(const iter& at) override;
49 nbool del(const iter& from, const iter& end) override;
50
51 // etc:
52 void rel() override;
53
57 void onCloneDeep(const clonable& from) override;
58
59 protected:
60 iteration* _onMakeIteration(const K* key, nbool isReversed, ncnt step, nbool isBoundary) const override;
61
62 void _getAll(const K& key, narr& tray) const override;
63
64 private:
65 nmapIteration* _getIterationFrom(const iter& it);
66
67 private:
68 cmap _map;
69 };
70} // namespace by
Interface for objects that can be cloned.
Definition: clonable.hpp:12
Deferred execution utility like defer keyword in other languages.
Definition: end.hpp:14
Definition: tnbicontainer.hpp:8
Definition: tnmap.hpp:11
nbool del(const K &key) override
void onCloneDeep(const clonable &from) override
Strong reference smart pointer with strict type checking.
Definition: tstr.hpp:13
Bidirectional iterator for key-value containers.
Definition: biter.hpp:9
Definition: biteration.hpp:5
Definition: nmapIteration.hpp:5