Boost logo

Boost :

Subject: [boost] [range] Should the result of irange satisfy the BidirectionalRangeConcept?
From: Vicente Botet (vicente.botet_at_[hidden])
Date: 2011-03-12 14:26:47


Hi,

I'm trying to define an enum_range and I based my implementation on the one
from irange.

While writing my test I started just by checking that my enum_range
satisfied the RandomAccessRangeConcept requirements and there were some
errors with BidirectionalRangeConcept. I replaced by the result type of the
irange function and the errors appear also there.

It seems that there is an issue concerning the category tags

..\..\../boost/concept_check.hpp:212:13: error: conversion from
'boost::detail::iterator_category_with_traversal<std::input_iterator_tag,
boost::random_access_traversal_tag>' to non-scalar type
'std::bidirectional_iterator_tag' requested

Am I missing something?

Best,
Vicente

== Test ==

#include <boost/range/concepts.hpp>
#include <boost/range/irange.hpp>

using namespace boost;

BOOST_CONCEPT_ASSERT(( BidirectionalRangeConcept < iterator_range<
range_detail::integer_iterator > > ));

== Result ==

gcc.compile.c++
..\..\..\bin.v2\libs\enums\test\enum_range__random_access_range_concept__pass.test\gcc-mingw-4.5.0\debug\enum_range\random_access_range_concept.pass.o
In file included from ..\..\../boost/range/concepts.hpp:19:0,
                 from ..\..\../boost/range/algorithm/equal.hpp:14,
                 from ..\..\../boost/range/iterator_range_core.hpp:29,
                 from ..\..\../boost/range/iterator_range.hpp:13,
                 from ..\..\../boost/enums/enum_range.hpp:24,
                 from enum_range\random_access_range_concept.pass.cpp:15:
..\..\../boost/concept_check.hpp: In destructor 'boost::Convertible&lt;X,
Y&gt;::~Convertible() [with X =
boost::detail::iterator_category_with_traversal&lt;std::input_iterator_tag,
boost::random_access_traversal_tag&gt;, Y =
std::bidirectional_iterator_tag]':
..\..\../boost/concept/detail/general.hpp:38:28: instantiated from 'static
void boost::concepts::requirement&lt;boost::concepts::failed************
Model::************&gt;::failed() [with Model =
boost::Convertible&lt;boost::detail::iterator_category_with_traversal&lt;std::input_iterator_tag,
boost::random_access_traversal_tag&gt;, std::bidirectional_iterator_tag>]'
..\..\../boost/concept_check.hpp:579:1: instantiated from
'boost::BidirectionalIterator::~BidirectionalIterator() [with TT =
boost::range_detail::integer_iterator]'
..\..\../boost/concept_check.hpp:571:1: instantiated from 'static void
boost::concepts::requirement&lt;boost::concepts::failed************
Model::************&gt;::failed() [with Model =
boost::BidirectionalIteratorConcept&lt;boost::range_detail::integer_iterator&lt;int&gt;
>]'
..\..\../boost/range/concepts.hpp:333:1: instantiated from
'boost::BidirectionalRangeConcept&lt;boost::iterator_range&lt;boost::range_detail::integer_iterator&lt;int&gt;
> >'
..\..\../boost/concept/detail/has_constraints.hpp:42:5: instantiated from
'const bool
boost::concepts::not_satisfied&lt;boost::BidirectionalRangeConcept&lt;boost::iterator_range&lt;boost::range_detail::integer_iterator&lt;int&gt;
> > >::value'
..\..\../boost/concept/detail/has_constraints.hpp:45:31: instantiated from
'boost::concepts::not_satisfied&lt;boost::BidirectionalRangeConcept&lt;boost::iterator_range&lt;boost::range_detail::integer_iterator&lt;int&gt;
> > >'
..\..\../boost/mpl/if.hpp:67:11: instantiated from
'boost::mpl::if_&lt;boost::concepts::not_satisfied&lt;boost::BidirectionalRangeConcept&lt;boost::iterator_range&lt;boost::range_detail::integer_iterator&lt;int&gt;
> > >,
boost::concepts::constraint&lt;boost::BidirectionalRangeConcept&lt;boost::iterator_range&lt;boost::range_detail::integer_iterator&lt;int&gt;
> > >, boost::concepts::requirement&lt;boost::concepts::failed************
boost::BidirectionalRangeConcept&lt;boost::iterator_range&lt;boost::range_detail::integer_iterator&lt;int&gt;
> >::************> >'
..\..\../boost/concept/detail/general.hpp:56:1: instantiated from
'boost::concepts::requirement_ > >)>'
enum_range\random_access_range_concept.pass.cpp:27:3: instantiated from
here
..\..\../boost/concept_check.hpp:212:13: error: conversion from
'boost::detail::iterator_category_with_traversal&lt;std::input_iterator_tag,
boost::random_access_traversal_tag&gt;' to non-scalar type
'std::bidirectional_iterator_tag' requested
..\..\../boost/concept_check.hpp: In destructor 'boost::Convertible&lt;X,
Y&gt;::~Convertible() [with X =
boost::detail::iterator_category_with_traversal&lt;std::input_iterator_tag,
boost::random_access_traversal_tag&gt;, Y = std::forward_iterator_tag]':
..\..\../boost/concept/detail/general.hpp:38:28: instantiated from 'static
void boost::concepts::requirement&lt;boost::concepts::failed************
Model::************&gt;::failed() [with Model =
boost::Convertible&lt;boost::detail::iterator_category_with_traversal&lt;std::input_iterator_tag,
boost::random_access_traversal_tag&gt;, std::forward_iterator_tag>]'
..\..\../boost/concept_check.hpp:551:1: instantiated from
'boost::ForwardIterator::~ForwardIterator() [with TT =
boost::range_detail::integer_iterator]'
..\..\../boost/concept/usage.hpp:22:29: instantiated from
'boost::concepts::usage_requirements::~usage_requirements() [with Model =
boost::ForwardIterator&lt;boost::range_detail::integer_iterator&lt;int&gt;
>]'
..\..\../boost/concept/detail/general.hpp:38:28: instantiated from 'static
void boost::concepts::requirement&lt;boost::concepts::failed************
Model::************&gt;::failed() [with Model =
boost::concepts::usage_requirements&lt;boost::ForwardIterator&lt;boost::range_detail::integer_iterator&lt;int&gt;
> >]'
..\..\../boost/concept_check.hpp:546:1: instantiated from
'boost::ForwardIterator&lt;boost::range_detail::integer_iterator&lt;int&gt;
>'
..\..\../boost/concept_check.hpp:573:3: [ skipping 6 instantiation
contexts ]
..\..\../boost/range/concepts.hpp:333:1: instantiated from
'boost::BidirectionalRangeConcept&lt;boost::iterator_range&lt;boost::range_detail::integer_iterator&lt;int&gt;
> >'
..\..\../boost/concept/detail/has_constraints.hpp:42:5: instantiated from
'const bool
boost::concepts::not_satisfied&lt;boost::BidirectionalRangeConcept&lt;boost::iterator_range&lt;boost::range_detail::integer_iterator&lt;int&gt;
> > >::value'
..\..\../boost/concept/detail/has_constraints.hpp:45:31: instantiated from
'boost::concepts::not_satisfied&lt;boost::BidirectionalRangeConcept&lt;boost::iterator_range&lt;boost::range_detail::integer_iterator&lt;int&gt;
> > >'
..\..\../boost/mpl/if.hpp:67:11: instantiated from
'boost::mpl::if_&lt;boost::concepts::not_satisfied&lt;boost::BidirectionalRangeConcept&lt;boost::iterator_range&lt;boost::range_detail::integer_iterator&lt;int&gt;
> > >,
boost::concepts::constraint&lt;boost::BidirectionalRangeConcept&lt;boost::iterator_range&lt;boost::range_detail::integer_iterator&lt;int&gt;
> > >, boost::concepts::requirement&lt;boost::concepts::failed************
boost::BidirectionalRangeConcept&lt;boost::iterator_range&lt;boost::range_detail::integer_iterator&lt;int&gt;
> >::************> >'
..\..\../boost/concept/detail/general.hpp:56:1: instantiated from
'boost::concepts::requirement_ > >)>'
enum_range\random_access_range_concept.pass.cpp:27:3: instantiated from
here
..\..\../boost/concept_check.hpp:212:13: error: conversion from
'boost::detail::iterator_category_with_traversal&lt;std::input_iterator_tag,
boost::random_access_traversal_tag&gt;' to non-scalar type
'std::forward_iterator_tag' requested

--
View this message in context: http://boost.2283326.n4.nabble.com/range-Should-the-result-of-irange-satisfy-the-BidirectionalRangeConcept-tp3350738p3350738.html
Sent from the Boost - Dev mailing list archive at Nabble.com.

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk