Modify

Ticket #6944 (closed Bugs: fixed)

Opened 2 years ago

Last modified 10 months ago

Some Range concepts use the incorrect Iterator concept

Reported by: Andrew Morris <andy@…> Owned by: nathanridge
Milestone: To Be Determined Component: range
Version: Boost 1.49.0 Severity: Problem
Keywords: range concept iterator Cc:

Description

Due to an omitted namespace specification, the BidirectionalRangeConcept? and RandomAccessRangeConcept? inside <boost\range\concepts.hpp> use the STL iterator concept checking classes in <boost\concept_check.hpp> instead of the appropriate concepts inside the same file.

This issue was actually noticed in ticket #4355, but a different fix was applied.

The reason that the Range concepts should not use the STL iterator concepts is because the Range concepts only require the relevant traversal concept. (Source)

This example fails on Cygwin g++4.7 and VC2010

#include <boost/concept_check.hpp>
#include <boost/iterator/iterator_adaptor.hpp>
#include <boost/range/concepts.hpp>
#include <boost/range/iterator_range.hpp>
#include <vector>

typedef std::vector<int>::iterator iter_base;
struct iter : boost::iterator_adaptor<iter, iter_base, int, boost::use_default, int> {}; // will be deduced as random-access traversal but input category
typedef boost::iterator_range<iter> iter_range;

BOOST_CONCEPT_ASSERT(( boost::RandomAccessRangeConcept<iter_range> ));

I've attached a patch for this issue.

Attachments

range_iter_bug.patch Download (1.5 KB) - added by Andrew Morris <andy@…> 2 years ago.
Fix

Change History

Changed 2 years ago by Andrew Morris <andy@…>

Fix

comment:1 Changed 2 years ago by Andrew Morris <andy@…>

  • Keywords range concept iterator added

comment:2 Changed 11 months ago by nathanridge

(In [84566]) [range] Use correct iterator concepts when checking Boost.Range concepts (refs #6944).

comment:3 Changed 11 months ago by nathanridge

  • Owner changed from neilgroves to nathanridge
  • Status changed from new to assigned

Thanks for the report and the patch! Fixed in trunk.

comment:4 Changed 11 months ago by nathanridge

(In [84643]) [range] Fixed a failing test on gcc 4.2 (refs #6944).

comment:5 Changed 10 months ago by nathanridge

  • Status changed from assigned to closed
  • Resolution set to fixed

(In [84823]) [range] Merge Boost.Range bug fixes to release branch (fixes #6944; fixes #7407; fixes #7408; fixes #7731; fixes #7827; fixes #8338; fixes #8453).

comment:6 Changed 10 months ago by nathanridge

Fixed for 1.54.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.