Discussion:
[range] join() and adaptors::transformed do not play nicely with each other
Nathan Ridge
2011-02-25 23:10:54 UTC
Permalink
Hello,

For the following code:

#include <vector>
#include <boost/range/adaptor/transformed.hpp>
#include <boost/range/join.hpp>

using boost::adaptors::transformed;
using boost::join;

int add1(int i) { return i + 1; }

int main()
{
std::vector<int> A, B;
auto joined = join(A | transformed(add1), B);
}


I get the following compiler errors:

In file included from ../shared/test/test.cpp:3:0:
../../lib/boost/boost/range/join.hpp: In instantiation of 'boost::range_detail
::joined_type<
const boost::range_detail::transformed_range<int (*)(int), vector<int>
, const vector<int>
../../lib/boost/boost/range/join.hpp:40:7: instantiated from 'boost
::joined_range<
const boost::range_detail::transformed_range<int (*)(int), vector<int>
, const vector<int>
'
../shared/test/test.cpp:13:48: instantiated from here
../../lib/boost/boost/range/join.hpp:34:7: error: no type named 'type' in
'boost::range_detail::demote_iterator_traversal_tag<
boost::detail::iterator_category_with_traversal<
input_iterator_tag, boost::random_access_traversal_tag
, boost::random_access_traversal_tag
'
../../lib/boost/boost/range/join.hpp: In instantiation of 'boost::joined_range<
const boost::range_detail::transformed_range<int (*)(int), vector<int>
, const vector<int>
../shared/test/test.cpp:13:48: instantiated from here
../../lib/boost/boost/range/join.hpp:47:11: error: no type named 'type' in
'boost::range_detail::demote_iterator_traversal_tag<
boost::detail::iterator_category_with_traversal<
input_iterator_tag, boost::random_access_traversal_tag
, boost::random_access_traversal_tag
'
What is going on?

Thanks,
Nate.
Neil Groves
2011-02-27 22:39:56 UTC
Permalink
Post by Nathan Ridge
../../lib/boost/boost/range/join.hpp:47:11: error: no type named 'type' in
'boost::range_detail::demote_iterator_traversal_tag<
boost::detail::iterator_category_with_traversal<
input_iterator_tag, boost::random_access_traversal_tag
Post by Nathan Ridge
, boost::random_access_traversal_tag
'
What is going on?
My implementation for calculating the minimum traversal is incomplete
because it does not provide template specializations for the
iterator_category_with_traversal class. I need to spend a little more time
looking into the best solution. A quick work-around would be to add the
appropriate specialization. I am concerned that this might be a special-case
of a more general issue with my code. I'll look into this more this week.
Post by Nathan Ridge
Thanks,
Nate.
Thank you for bringing this to my attention.

Regards,
Neil Groves

Loading...