123456789101112131415161718192021222324252627282930313233343536373839 |
- #ifndef SIMPLE_MOTION_COMMON_HPP
- #define SIMPLE_MOTION_COMMON_HPP
- #include "simple/support/range.hpp"
- #include "simple/support/type_traits/conversions.hpp" // converts_to
- namespace simple::motion
- {
- template <typename T>
- concept basic = requires(T t)
- {
- {t.advance(typename T::duration{})} -> support::converts_to<bool>;
- {t.done()} -> support::converts_to<bool>;
- t.reset();
- // FIXME: pain points
- // t.value();
- // t.move(, T::duration{})
- };
- template <typename Duration>
- struct advance_result
- {
- bool done;
- Duration remaining{};
- explicit operator bool() { return done; } // negate?
- };
- template <typename Duration, typename It = size_t>
- struct multi_advance_result : public advance_result<Duration>
- {
- support::range<It> updated {};
- using advance_result<Duration>::operator bool;
- };
- } // namespace simple::motion
- #endif /* end of include guard */
|