10 template <
typename T,
typename R,
typename RSquare>
class tnucontainer;
11 template <
typename T,
typename TACTIC>
class tnarr;
12 typedef class _nout tnarr<node, strTactic> narr;
13 template <
typename K,
typename V>
class tbicontainable;
19 template <
typename T,
typename R = T*,
typename RSquare = T&>
class tucontainable {
21 static constexpr nbool _IS_POINTER = std::is_pointer_v<R>;
30 virtual ncnt len()
const = 0;
32 nbool in(
const T& it)
const;
33 nbool in(
const T* it)
const BY_SIDE_FUNC(in);
34 nbool in(std::function<nbool(
const T&)> l)
const;
35 template <
typename T1> nbool in(std::function<nbool(
const T1&)> l)
const;
37 nbool isEmpty()
const;
40 template <
typename T1> std::conditional_t<_IS_POINTER, T1*, tmay<T1>> get(std::function<nbool(
const T1&)> l) {
41 for(
auto e = begin(); e; ++e) {
42 if constexpr(_IS_POINTER) {
43 T1& val = e->template cast<T1>() OR_CONTINUE;
47 T1& val = e.get().template cast<T1>() OR_CONTINUE;
53 if constexpr(_IS_POINTER)
return nullptr;
57 std::conditional_t<_IS_POINTER, R, tmay<R>> get(std::function<nbool(
const T&)> l) {
return this->get<T>(l); }
59 template <
typename T1>
60 std::conditional_t<_IS_POINTER, const T1*, tmay<T1>> get(std::function<nbool(
const T1&)> l)
const
62 std::conditional_t<_IS_POINTER, const R, tmay<R>> get(std::function<nbool(
const T&)> l)
const
68 template <
typename T1>
void each(std::function<nbool(T1&)> l);
69 void each(std::function<nbool(T&)> l);
70 template <
typename T1>
void each(std::function<nbool(
const T1&)> l)
const BY_CONST_FUNC(each(l))
71 void each(std::function<nbool(
const T&)> l)
const BY_CONST_FUNC(each(l))
78 virtual iter rend()
const;
80 virtual iter last()
const;
82 iter iterate(ncnt step)
const;
83 iter iterate(
const T& it)
const;
85 iter riterate(ncnt step)
const;
86 iter riterate(
const T& it)
const;
89 virtual nbool set(
const iter& at,
const T& new1) = 0;
90 virtual nbool set(
const iter& at,
const T* new1) BY_SIDE_FUNC(new1, set(at, *new1),
false);
93 virtual nbool add(
const iter& at,
const T& new1) = 0;
94 nbool add(
const iter& at,
const T* new1) BY_SIDE_FUNC(new1, add(at, *new1),
false);
95 nbool add(std::initializer_list<const T*> elems);
96 nbool add(
const T& new1);
97 nbool add(
const T* it) BY_SIDE_FUNC(add);
98 virtual void add(
const iter& here,
const iter& from,
const iter& to) = 0;
99 void add(
const iter& from,
const iter& to);
100 void add(
const iter& here, me& rhs);
101 void add(
const me& rhs);
102 void add(
const me* rhs) BY_SIDE_FUNC(rhs, add(*rhs),
void());
104 template <
typename E>
106 static_assert(areBaseOfT<T, E>::value,
"given type 'E' is not subtype of 'T'");
108 for(
auto e = from; e != to; ++e)
113 template <
typename E> ncnt add(
const tucontainable<E>& rhs) {
return add(rhs.begin(), rhs.end()); }
120 nbool
del(
const T& it);
121 nbool
del(
const T* it) BY_SIDE_FUNC(
del);
122 virtual nbool
del(
const iter& it) = 0;
124 nbool
del(
const me& rhs);
125 nbool
del(
const me* rhs) BY_SIDE_FUNC(rhs,
del(*rhs),
false);
128 virtual void rel() = 0;
131 virtual iteration* _onMakeIteration(ncnt step, nbool isReversed)
const = 0;
Deferred execution utility like defer keyword in other languages.
Definition: end.hpp:14
Template bidirectional container interface.
Definition: tbicontainable.hpp:17
Optional value wrapper with byeol-style interface.
Definition: tmay.hpp:18
Template unidirectional container interface.
Definition: tucontainable.hpp:19
nbool del()
delete last element if exists.
Bidirectional iterator for key-value containers.
Definition: biter.hpp:9
Definition: biteration.hpp:5