You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
vector<Interval<T> > intervals;
T a, b, c;
intervals.push_back(Interval<T>(2, 10, a));
intervals.push_back(Interval<T>(3, 4, b));
intervals.push_back(Interval<T>(20, 100, c));
IntervalTree<T> tree;
tree = IntervalTree<T>(intervals);
doesn't compile.
E.g. wrap it in a function as follows, and try compiling:
template<typename T>
void foo() {
vector<Interval<T> > intervals;
T a, b, c;
intervals.push_back(Interval<T>(2, 10, a));
intervals.push_back(Interval<T>(3, 4, b));
intervals.push_back(Interval<T>(20, 100, c));
IntervalTree<T> tree;
tree = IntervalTree<T>(intervals);
}
Problems include:
the Interval and IntervalTree templates take two parameters, not one - Interval<T> and IntervalTree<T> are not correct. (Presumably it should be something like Interval<size_t, T> etc., like in interval_tree_test.cpp.
the call to the constructor doesn't compile. If you call foo<bool>() and compile, you'll get errors along the lines of (summarizing):
error: no matching conversion for functional-style cast from 'vector<Interval<size_t, bool> >' (aka 'vector<Interval<unsigned long, bool> >') to 'IntervalTree<size_t, bool>' (aka 'IntervalTree<unsigned long, bool>')
// ...
./intervaltree/IntervalTree.h:92:5: note: candidate constructor not viable: no known conversion from 'vector<Interval<size_t, bool> >' (aka 'vector<Interval<unsigned long, bool> >') to 'IntervalTree<unsigned long, bool>::interval_vector &&' (aka 'vector<Interval<unsigned long, bool> > &&') for 1st argument
From the interval_tree_test.cpp test file, it looks like the constructor now takes an initializer list.
The text was updated successfully, but these errors were encountered:
As an aside - why would you change the constructor in this way, anyway? It seems considerably less convenient to take an initializer list instead of (say) a pair of begin, end iterators.
The example in the README:
doesn't compile.
E.g. wrap it in a function as follows, and try compiling:
Problems include:
the
Interval
andIntervalTree
templates take two parameters, not one -Interval<T>
andIntervalTree<T>
are not correct. (Presumably it should be something likeInterval<size_t, T>
etc., like in interval_tree_test.cpp.the call to the constructor doesn't compile. If you call
foo<bool>()
and compile, you'll get errors along the lines of (summarizing):From the interval_tree_test.cpp test file, it looks like the constructor now takes an initializer list.
The text was updated successfully, but these errors were encountered: