or.hpp
Go to the documentation of this file.
1
3#pragma once
4
5#include "indep/macro/to.hpp"
6
7namespace by {
8
115
116#define __OR_DO__(_expr_) \
117 | [&](auto&& __p) -> void { \
118 __orStack__::push(nul(__p) ? _expr_ : false); \
119 }; \
120 if(__orStack__::pop())
121
122#define OR_DO __OR_DO__(nul(__p))
123
124#define __OR__(expr) __OR_DO__(expr) return BY_WHEN
125#define OR __OR__(nul(__p))
126#define OR_RET_CTOR __OR_DO__(nul(__p)) return
127
128#define OR_CONTINUE OR_DO continue
129
130 struct __orStack__ {
131 static void push(nbool val) { _stack.push_back(val); }
132
133 static nbool pop() {
134 nbool ret = _stack.back();
135 _stack.pop_back();
136 return ret;
137 }
138
139 private:
140 inline static std::vector<nbool> _stack;
141 };
142
143} // namespace by
Definition: or.hpp:130