Added timeline constructor overloads
This commit is contained in:
parent
6d67f77f62
commit
1e5a21dbfb
|
@ -29,6 +29,11 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
template<typename collection_type>
|
||||
BoundedTimeline(TimeRange range, collection_type collection) :
|
||||
BoundedTimeline(range, collection.begin(), collection.end())
|
||||
{}
|
||||
|
||||
BoundedTimeline(TimeRange range, std::initializer_list<Timed<T>> initializerList) :
|
||||
BoundedTimeline(range, initializerList.begin(), initializerList.end())
|
||||
{}
|
||||
|
|
|
@ -24,11 +24,16 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
template<typename collection_type>
|
||||
ContinuousTimeline(TimeRange range, T defaultValue, collection_type collection) :
|
||||
ContinuousTimeline(range, defaultValue, collection.begin(), collection.end())
|
||||
{}
|
||||
|
||||
ContinuousTimeline(TimeRange range, T defaultValue, std::initializer_list<Timed<T>> initializerList) :
|
||||
ContinuousTimeline(range, defaultValue, initializerList.begin(), initializerList.end())
|
||||
{}
|
||||
|
||||
using BoundedTimeline<T>::clear;
|
||||
using BoundedTimeline<T>::clear;
|
||||
|
||||
void clear(const TimeRange& range) override {
|
||||
BoundedTimeline<T>::set(Timed<T>(range, defaultValue));
|
||||
|
|
|
@ -98,6 +98,11 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
template<typename collection_type>
|
||||
explicit Timeline(collection_type collection) :
|
||||
Timeline(collection.begin(), collection.end())
|
||||
{}
|
||||
|
||||
explicit Timeline(std::initializer_list<Timed<T>> initializerList) :
|
||||
Timeline(initializerList.begin(), initializerList.end())
|
||||
{}
|
||||
|
|
|
@ -22,6 +22,10 @@ TEST(BoundedTimeline, constructors_initializeState) {
|
|||
BoundedTimeline<int>(range, args.begin(), args.end()),
|
||||
ElementsAreArray(expected)
|
||||
);
|
||||
EXPECT_THAT(
|
||||
BoundedTimeline<int>(range, vector<Timed<int>>(args)),
|
||||
ElementsAreArray(expected)
|
||||
);
|
||||
EXPECT_THAT(
|
||||
BoundedTimeline<int>(range, args),
|
||||
ElementsAreArray(expected)
|
||||
|
|
|
@ -24,6 +24,10 @@ TEST(ContinuousTimeline, constructors_initializeState) {
|
|||
ContinuousTimeline<int>(range, defaultValue, args.begin(), args.end()),
|
||||
ElementsAreArray(expected)
|
||||
);
|
||||
EXPECT_THAT(
|
||||
ContinuousTimeline<int>(range, defaultValue, vector<Timed<int>>(args)),
|
||||
ElementsAreArray(expected)
|
||||
);
|
||||
EXPECT_THAT(
|
||||
ContinuousTimeline<int>(range, defaultValue, args),
|
||||
ElementsAreArray(expected)
|
||||
|
|
|
@ -24,6 +24,10 @@ TEST(Timeline, constructors_initializeState) {
|
|||
Timeline<int>(args.begin(), args.end()),
|
||||
ElementsAreArray(expected)
|
||||
);
|
||||
EXPECT_THAT(
|
||||
Timeline<int>(vector<Timed<int>>(args)),
|
||||
ElementsAreArray(expected)
|
||||
);
|
||||
EXPECT_THAT(
|
||||
Timeline<int>(args),
|
||||
ElementsAreArray(expected)
|
||||
|
|
Loading…
Reference in New Issue