Loading...
Searching...
No Matches
or.hpp
Go to the documentation of this file.
1
4#pragma once
5
6#include "indep/macro/to.hpp"
7
8namespace by {
9
128#define __OR_DO__(_expr_) \
129 | [&](auto&& __p) -> void { \
130 __orStack__::push(nul(__p) ? _expr_ : false); \
131 }; \
132 if(__orStack__::pop())
133
134#define OR_DO __OR_DO__(nul(__p))
135
136#define __OR__(expr) __OR_DO__(expr) return BY_WHEN
137#define OR __OR__(nul(__p))
138#define OR_RET_CTOR __OR_DO__(nul(__p)) return
139
140#define OR_CONTINUE OR_DO continue
141
142 struct __orStack__ {
143 static void push(nbool val) { _stack.push_back(val); }
144
145 static nbool pop() {
146 nbool ret = _stack.back();
147 _stack.pop_back();
148 return ret;
149 }
150
151 private:
152 inline static std::vector<nbool> _stack;
153 };
154
155} // namespace by
Weak reference smart pointer with type-safe access.
Definition tweak.hpp:16
Definition or.hpp:142
to Top