To my surprise this Concept-like assertion fails in RangeV3.
#include<vector>
#include<range/v3/algorithm/copy.hpp>
int main(){
static_assert(ranges::WeaklyIncrementable<std::back_insert_iterator<std::vector<double> >>());
}
Why is that?
This, among other things means that I cannot use the ranges::copy algorithm as I use to do with std::copy.
std::vector<double> w(100);
std::vector<double> v;
ranges::copy(
begin(w), end(w),
std:back_inserter(v)
); // compilation error, concept not fulfilled.
Is this the canonical way to back_insert in RangesV3?
I cannot find the WeaklyIncrementable documentation in RangeV3, but in cppreference https://en.cppreference.com/w/cpp/experimental/ranges/iterator/WeaklyIncrementable it seems that there is a "signed different type" that is probably not defined for back_inserter_iterator. This probably means 1 or 3 things, a) RangeV3 is overconstraining the copy requirements b) copy is not the algorithm for back insertion, c) I have no clue how to use RangeV3.
Found this https://github.com/ericniebler/range-v3/issues/867, a possible workaround it to use range::back_inserter(v) instead of std::back_inserter(v). It seems that there is a default constructibility requirement somewhere.