20 template <
typename T,
typename R = T*,
typename RSquare = T&>
class tucontainable {
22 static constexpr nbool _IS_POINTER = std::is_pointer_v<R>;
31 virtual ncnt len()
const = 0;
33 nbool in(
const T& it)
const;
35 nbool in(std::function<nbool(
const T&)> l)
const;
36 template <
typename T1> nbool in(std::function<nbool(
const T1&)> l)
const;
38 nbool isEmpty()
const;
41 template <
typename T1> std::conditional_t<_IS_POINTER, T1*, tmay<T1>> get(std::function<nbool(
const T1&)> l) {
42 for(
auto e = begin();
e; ++
e) {
43 if constexpr(_IS_POINTER) {
54 if constexpr(_IS_POINTER)
return nullptr;
58 std::conditional_t<_IS_POINTER, R, tmay<R>> get(std::function<nbool(
const T&)> l) {
return this->
get<T>(l); }
60 template <
typename T1>
61 std::conditional_t<_IS_POINTER, const T1*, tmay<T1>> get(std::function<nbool(
const T1&)> l)
const
63 std::conditional_t<_IS_POINTER, const R, tmay<R>> get(std::function<nbool(
const T&)> l)
const
69 template <
typename T1>
void each(std::function<nbool(
T1&)> l);
70 void each(std::function<nbool(T&)> l);
71 template <
typename T1>
void each(std::function<nbool(
const T1&)> l)
const BY_CONST_FUNC(each(l))
72 void each(std::function<nbool(
const T&)> l)
const BY_CONST_FUNC(each(l))
79 virtual iter rend()
const;
81 virtual iter last()
const;
84 iter iterate(
const T& it)
const;
87 iter riterate(
const T& it)
const;
90 virtual nbool set(
const iter&
at,
const T& new1) = 0;
94 virtual nbool add(
const iter&
at,
const T& new1) = 0;
96 nbool add(std::initializer_list<const T*>
elems);
97 nbool add(
const T& new1);
101 void add(
const iter&
here, me& rhs);
102 void add(
const me& rhs);
103 void add(
const me* rhs)
BY_SIDE_FUNC(rhs, add(*rhs),
void());
105 template <
typename E>
107 static_assert(areBaseOfT<T, E>::value,
"given type 'E' is not subtype of 'T'");
109 for(
auto e = from;
e !=
to; ++
e)
114 template <
typename E> ncnt add(
const tucontainable<E>& rhs) {
return add(rhs.begin(), rhs.end()); }
123 nbool
del(
const T& it);
125 virtual nbool
del(
const iter& it) = 0;
127 nbool
del(
const me& rhs);
131 virtual void rel() = 0;
134 virtual iteration* _onMakeIteration(ncnt
step, nbool isReversed)
const = 0;
#define BY_SIDE_FUNC(...)
Side function macros for safe pointer operations.
Definition sideFunc.hpp:24