#pragma once #include "BoundedTimeline.h" template class ContinuousTimeline : public BoundedTimeline { public: ContinuousTimeline(TimeRange range, T defaultValue) : BoundedTimeline(range), defaultValue(defaultValue) { // Virtual function call in constructor. Derived constructors shouldn't call this one! ContinuousTimeline::clear(range); } template ContinuousTimeline(TimeRange range, T defaultValue, InputIterator first, InputIterator last) : ContinuousTimeline(range, defaultValue) { // Virtual function calls in constructor. Derived constructors shouldn't call this one! for (auto it = first; it != last; ++it) { ContinuousTimeline::set(*it); } } ContinuousTimeline(TimeRange range, T defaultValue, std::initializer_list> initializerList) : ContinuousTimeline(range, defaultValue, initializerList.begin(), initializerList.end()) {} using BoundedTimeline::clear; void clear(const TimeRange& range) override { set(Timed(range, defaultValue)); } private: T defaultValue; };