diff --git a/ClockReceiver/Dispatcher.hpp b/ClockReceiver/Dispatcher.hpp index 460f2aa8a..98fec3cd4 100644 --- a/ClockReceiver/Dispatcher.hpp +++ b/ClockReceiver/Dispatcher.hpp @@ -11,7 +11,7 @@ namespace Dispatcher { -template +template struct Dispatcher { /// Perform @c target.perform() for the input range `start <= n < end`. @@ -21,7 +21,7 @@ struct Dispatcher { // Minor optimisation: do a comparison with end once outside the loop and if it implies so // then do no further comparisons within the loop. This is somewhat targetted at expected // use cases. - if(end < max) { + if(end < SequencerT::max) { dispatch(target, start, end, args...); } else { dispatch(target, start, end, args...); @@ -30,7 +30,7 @@ struct Dispatcher { private: template void dispatch(SequencerT &target, int start, int end, Args&&... args) { - static_assert(max < 2048); + static_assert(SequencerT::max < 2048); // Yes, macros, yuck. But I want an actual switch statement for the dispatch to start // and to allow a simple [[fallthrough]] through all subsequent steps up until end. @@ -38,15 +38,15 @@ private: // // Sensible choices by the optimiser are assumed. -#define index(n) \ - case n: \ - if constexpr (n <= max) { \ - if constexpr (n == max) return; \ - if constexpr (n < max) { \ - if(use_end && end == n) return; \ - } \ - target.template perform(args...); \ - } \ +#define index(n) \ + case n: \ + if constexpr (n <= SequencerT::max) { \ + if constexpr (n == SequencerT::max) return; \ + if constexpr (n < SequencerT::max) { \ + if(use_end && end == n) return; \ + } \ + target.template perform(args...); \ + } \ [[fallthrough]]; #define index2(n) index(n); index(n+1);