#ifndef ACTIVITY_H #define ACTIVITY_H #include #include #include class Vehicle; class Activity { public: Activity() = default; DEFAULT_MOVE_COPY(Activity); virtual ~Activity() = default; virtual void apply(Vehicle *, TickDuration) const = 0; template class Of; }; using ActivityPtr = std::unique_ptr; template concept ActivityConcept = std::is_base_of_v; template class Can { public: virtual void doActivity(const AC *, TickDuration) = 0; }; template class Activity::Of : public Activity { void apply(Vehicle * v, TickDuration dur) const override { if (auto tv = dynamic_cast *>(v)) { tv->doActivity(static_cast(this), dur); } } }; #endif