|
Boost : |
From: shunsuke (pstade.mb_at_[hidden])
Date: 2007-11-28 18:12:36
Hi,
See this example, which doesn't compile for now:
#include <list>
#include <string>
#include <boost/tuple/tuple.hpp>
#include <boost/iterator/zip_iterator.hpp>
#include <boost/iterator/transform_iterator.hpp>
int to_value(int const &v)
{
return v;
}
int main()
{
std::list<int> rng1;
std::string rng2;
boost::make_zip_iterator(
boost::make_tuple(
boost::make_transform_iterator(rng1.begin(), &to_value), // BidirectionalInput
rng2.begin() // RandomAccess
)
);
}
This incurs an error:
boost::detail::error_not_related_by_convertibility<T1,T2>' : base class undefined
with
T1=boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::bidirectional_traversal_tag>,
T2=boost::random_access_traversal_tag
in minimum_traversal_category_in_iterator_tuple.
template<typename IteratorTuple>
struct minimum_traversal_category_in_iterator_tuple
{
typedef typename tuple_impl_specific::tuple_meta_transform<
IteratorTuple
, iterator_traversal<> // !!!!!
>::type tuple_of_traversal_tags;
// ...
};
Couldn't "iterator_pure_traversal<>" be used instead of `iterator_traversal<>` here?
The iterator_pure_traversal<> could be something like this:
template< class Iterator = mpl::_1 >
struct iterator_pure_traversal :
boost::detail::pure_traversal_tag<
typename boost::iterator_traversal<Iterator>::type
>
{ };
Once Category is turned into pure one, the above example compiles.
Is there any pitfalls if Category is "purified"?
Regards,
-- Shunsuke Sogame
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk