36 operator int()
const {
return value_; }
37 int&
operator=(
int v) { modified_ =
true;
return value_ = v; }
40 #define CORO_REENTER(c) \
41 switch (coroutine_ref _coro_value = c) \
42 case -1: if (_coro_value) \
44 goto terminate_coroutine; \
45 terminate_coroutine: \
47 goto bail_out_of_coroutine; \
48 bail_out_of_coroutine: \
53 #define CORO_YIELD_IMPL(n) \
54 for (_coro_value = (n);;) \
55 if (_coro_value == 0) \
61 switch (_coro_value ? 0 : 1) \
63 case -1: if (_coro_value) \
64 goto terminate_coroutine; \
66 case 1: if (_coro_value) \
67 goto bail_out_of_coroutine; \
70 #define CORO_FORK_IMPL(n) \
71 for (_coro_value = -(n);; _coro_value = (n)) \
72 if (_coro_value == (n)) \
80 # define CORO_YIELD CORO_YIELD_IMPL(__COUNTER__ + 1)
81 # define CORO_FORK CORO_FORK_IMPL(__COUNTER__ + 1)
82 #else // defined(_MSC_VER)
83 # define CORO_YIELD CORO_YIELD_IMPL(__LINE__)
84 # define CORO_FORK CORO_FORK_IMPL(__LINE__)
85 #endif // defined(_MSC_VER)
87 #endif // COROUTINE_HPP
coroutine_ref(coroutine &c)
void operator=(const coroutine_ref &)=delete
coroutine_ref(coroutine *c)