| 47 | } |
| 48 | |
| 49 | forceinline ExecStatus |
| 50 | When::post(Home home, BoolView x, |
| 51 | std::function<void(Space& home)> t, |
| 52 | std::function<void(Space& home)> e) { |
| 53 | if (!t) |
| 54 | throw InvalidFunction("When::When"); |
| 55 | if (!e) |
| 56 | throw InvalidFunction("When::When"); |
| 57 | if (x.zero()) { |
| 58 | e(home); |
| 59 | return home.failed() ? ES_FAILED : ES_OK; |
| 60 | } else if (x.one()) { |
| 61 | t(home); |
| 62 | return home.failed() ? ES_FAILED : ES_OK; |
| 63 | } else { |
| 64 | (void) new (home) When(home,x,t,e); |
| 65 | return ES_OK; |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | }}} |
| 70 |