Opened 12 years ago

Closed 12 years ago

#4355 closed Patches (fixed)

without namespace 'range_detail'

Reported by: rick68@… Owned by: Neil Groves
Milestone: Boost 1.46.0 Component: range
Version: Boost 1.44.0 Severity: Cosmetic
Keywords: range concept Cc:

Description

Hi, I found some bugs in <boost/range/concepts.hpp>.

--- concepts.hpp.orig 2010-06-14 16:33:32.700239204 +0800 +++ concepts.hpp 2010-06-17 07:05:44.209528094 +0800 @@ -295,8 +295,8 @@

struct BidirectionalRangeConcept : ForwardRangeConcept<T> {

#if BOOST_RANGE_ENABLE_CONCEPT_ASSERT

+ BOOST_RANGE_CONCEPT_ASSERT((range_detail::BidirectionalIteratorConcept<BOOST_DEDUCED_TYPENAME BidirectionalRangeConcept::iterator>)); + BOOST_RANGE_CONCEPT_ASSERT((range_detail::BidirectionalIteratorConcept<BOOST_DEDUCED_TYPENAME BidirectionalRangeConcept::const_iterator>));

#endif

};

@@ -313,8 +313,8 @@

struct RandomAccessRangeConcept : BidirectionalRangeConcept<T> {

#if BOOST_RANGE_ENABLE_CONCEPT_ASSERT

+ BOOST_RANGE_CONCEPT_ASSERT((range_detail::RandomAccessIteratorConcept<BOOST_DEDUCED_TYPENAME RandomAccessRangeConcept::iterator>)); + BOOST_RANGE_CONCEPT_ASSERT((range_detail::RandomAccessIteratorConcept<BOOST_DEDUCED_TYPENAME RandomAccessRangeConcept::const_iterator>));

#endif

};

Attachments (2)

concepts.hpp.diff (1.5 KB ) - added by rick68@… 12 years ago.
without namespace 'range_detail'
test.cpp (1.8 KB ) - added by rick68@… 12 years ago.
test BidirectionalRangeConcept

Download all attachments as: .zip

Change History (11)

by rick68@…, 12 years ago

Attachment: concepts.hpp.diff added

without namespace 'range_detail'

comment:1 by Steven Watanabe, 12 years ago

Severity: ProblemCosmetic

The code works correctly without this patch, because Boost.ConceptCheck includes these concepts in the boost namespace. What I'd like to know is why range defines its own versions of the iterator concepts, instead of using the ones from Boost.ConceptCheck?

in reply to:  1 comment:2 by rick68@…, 12 years ago

Replying to steven_watanabe:

The code works correctly without this patch, because Boost.ConceptCheck includes these concepts in the boost namespace. What I'd like to know is why range defines its own versions of the iterator concepts, instead of using the ones from Boost.ConceptCheck?

In Boost.ConceptCheck are 'BidirectionalIterator' and 'RandomAccessIterator', I can't find 'BidirectionalIteratorConcept' and 'RandomAccessIteratorConcept'.

comment:3 by Steven Watanabe, 12 years ago

If you trace through the macros, you'll find that they define versions both with and without the Concept suffix.

by rick68@…, 12 years ago

Attachment: test.cpp added

in reply to:  3 comment:4 by rick68@…, 12 years ago

Replying to steven_watanabe:

If you trace through the macros, you'll find that they define versions both with and without the Concept suffix.

I attach 'test.cpp', maybe you can test it :)

comment:5 by Steven Watanabe, 12 years ago

with the trunk I get

C:\boost\trunk\boost/concept_check.hpp(516) : error C2100: illegal indirection
        C:\boost\trunk\boost/concept_check.hpp(510) : while compiling class template member function 'boost::ForwardIterator<TT>::~ForwardIterator(void)'
        with
        [
            TT=Iterator<ValueType>
        ]

which is the expected result, as there's no operator*.

in reply to:  5 comment:6 by rick68@…, 12 years ago

Replying to steven_watanabe:

with the trunk I get

C:\boost\trunk\boost/concept_check.hpp(516) : error C2100: illegal indirection
        C:\boost\trunk\boost/concept_check.hpp(510) : while compiling class template member function 'boost::ForwardIterator<TT>::~ForwardIterator(void)'
        with
        [
            TT=Iterator<ValueType>
        ]

which is the expected result, as there's no operator*.

BidirectionalIteratorConcept check concept with ForwardIteratorConcept, DefaultConstructiable, SignlePassIterator, IncrementableIteratorConcept, EqualityComparable and CopyConstructiable, they are not to check operator*. But if I add 'detail_range::' in concepts.hpp at line 298, 299, the compiler can complete this code.

comment:7 by Steven Watanabe, 12 years ago

Oh. I see that range_detail::ForwardIteratorConcept doesn't check for operator*. This is a bug. operator* is required for ForwardIterators. test.cpp should not compile.

comment:8 by Neil Groves, 12 years ago

Status: newassigned

comment:9 by Neil Groves, 12 years ago

Milestone: Boost 1.43.0Boost 1.46.0
Resolution: fixed
Status: assignedclosed

Resolved on the trunk.

Note: See TracTickets for help on using tickets.