diff --git a/ClockReceiver/Dispatcher.hpp b/ClockReceiver/Dispatcher.hpp index 299b87816..e7046bce2 100644 --- a/ClockReceiver/Dispatcher.hpp +++ b/ClockReceiver/Dispatcher.hpp @@ -93,3 +93,46 @@ private: } #endif /* Dispatcher_hpp */ + +/* +template constexpr int lower_bound() { + if constexpr (!x || ClassifierT::template type() != ClassifierT::template type()) { + return x; + } else { + return lower_bound(); + } +} + +template +void range_dispatch(TargetT &destination, int start, int end) { +#define case(x) case x: \ + if constexpr (x+1 == ClassifierT::max || ClassifierT::template type() != ClassifierT::template type()) { \ + const auto range_begin = std::max(start, lower_bound()); \ + const auto range_end = std::min(end, x + 1); \ + \ + if(range_begin == lower_bound()) {\ + destination.template begin()>(range_begin); \ + }\ + destination.template perform()>(range_begin, range_end); \ + if(range_end == x+1) {\ + destination.template end()>(range_begin); \ + }\ + if(x+1 >= end) { \ + break; \ + } \ + } \ + [[fallthrough]]; + + switch(start) { + case(0) + case(1) + case(2) + case(3) + case(4) + case(5) + } + +#undef case +} + + */