8#include "indep/helper/tmedium.inl"
50 template <
typename T>
class tmay:
private std::optional<T> {
51 BY(ME(
tmay, std::optional<T>))
60 const T* operator->()
const BY_CONST_FUNC(
operator->());
62 const T& operator*()
const BY_CONST_FUNC(
operator*());
64 operator const T&()
const;
65 operator nbool()
const;
92 template <
typename T,
typename F>
tmedium<T> operator|(
const T*
t,
F&&
f) {
99 template <
typename T,
typename F> T& operator|(tmay<T>& t, F&& f) {
106 template <
typename T,
typename F>
const T& operator|(
const tmay<T>& t, F&& f) {
113 template <
typename T,
typename F> tmay<T> operator|(tmay<T>&& t, F&& f) {
122 static nbool isNul(
const tmay<T>& it) {
return !it.has(); }
124 static constexpr nbool is_ptr =
false;
125 static constexpr nbool is_ref =
false;
126 static constexpr nbool is_like_ptr =
true;
130 static nbool isNul(
const tmay<T>& it) {
return !it.has(); }
132 static constexpr nbool is_ptr =
false;
133 static constexpr nbool is_ref =
true;
134 static constexpr nbool is_like_ptr =
true;
138 template <
typename T,
typename F>
143 template <
typename T,
typename F>
144 auto operator->*(
const tmay<T>& t, F&& f) ->
decltype(typeTrait<
decltype(f(*t))>::ret()) {
145 return t ? f(*t) : typeTrait<decltype(f(*t))>::ret();
148 template <
typename T,
typename F>
149 auto operator->*(tmay<T>&& t, F&& f) ->
decltype(typeTrait<
decltype(f(*t))>::ret()) {
150 return t ? f(*t) : typeTrait<decltype(f(*t))>::ret();
Optional value wrapper for error indication without exceptions
Definition tmay.hpp:50
const T * get() const BY_CONST_FUNC(get()) virtual void rel()
Releases/clears the contained value, making the instance empty.
T * get()
Gets the contained value.
Medium class used exclusively in the OR macro for safe reference handling
Definition tmedium.hpp:52
Rich logging support with polymorphic type conversion
Definition richLog.hpp:34
Type trait utilities for template metaprogramming
Definition typeTrait.hpp:14