I am trying to convert my range (pair of iterators) to iterator_range
so that I can take advantage of all the views and actions. I am able to convert my range to boost::iterator_range, but am getting a compilation failure when converting to range::v3. Here is a minimal example:
struct MyRange
{
struct iterator_t : std::iterator<std::input_iterator_tag, int>
{
friend bool operator==(const iterator_t& lhs, const iterator_t& rhs);
friend bool operator!=(const iterator_t& lhs, const iterator_t& rhs);
};
iterator_t begin() { return iterator_t{}; };
iterator_t end() { return iterator_t{}; };
};
int main(int argc, char *argv[])
{
auto my_range = MyRange{};
auto boost_range = boost::make_iterator_range(my_range.begin(), my_range.end()); // works
auto v3_range = ranges::v3::make_iterator_range(my_range.begin(), my_range.end()); // doesn't compile
}
It looks like I need to do something to satisfy the Sentinel
concept of the iterator_range
, but I haven't been able to figure out what. Any help is appreciated!
Edit: I am compiling with gcc54 -std=c++14. range v3/c++ compilations errors are kind of long, but here is a snippet:
range-v3/include/range/v3/iterator_range.hpp:171:17: note: in expansion of macro 'CONCEPT_REQUIRES_'
CONCEPT_REQUIRES_(Sentinel<S, I>())>
^
range-v3/include/range/v3/utility/concepts.hpp:669:15: note: invalid template non-type parameter
>::type = 0 \
^
range-v3/include/range/v3/iterator_range.hpp:171:17: note: in expansion of macro 'CONCEPT_REQUIRES_'
CONCEPT_REQUIRES_(Sentinel<S, I>())>