Opened 10 years ago

Closed 9 years ago

#8483 closed Bugs (fixed)

Fix for reference type deduction in join_iterator.hpp

Reported by: stheophil@… Owned by: Nathan Ridge
Milestone: To Be Determined Component: range
Version: Boost 1.55.0 Severity: Problem
Keywords: join_iterator Cc:

Description

Changeset 70041 introduced a better reference type deduction for join_iterators (https://svn.boost.org/trac/boost/changeset/70041) that was originally proposed by my colleague aschoedl.

The deduction contains a bug however that (I think) the attached patch fixes

Attachments (1)

join_iterator_original.hpp.patch (835 bytes ) - added by stheophil@… 10 years ago.

Download all attachments as: .zip

Change History (7)

by stheophil@…, 10 years ago

comment:1 by Nathan Ridge, 9 years ago

Could you please give an example of a piece of code that doesn't work as expected without this fix?

Thanks!

comment:2 by stheophil@…, 9 years ago

I'm sorry it took so long for me to respond. The problem is easy to replicate:

typedef boost::join_iterator< 
   std::vector<int>::const_iterator, 
   std::vector<int>::iterator 
> JoinIterator;

static_assert( std::is_same< 
   typename JoinIterator::reference, 
   int const& 
>::value, "" );

The static_assert should not trigger but it does with the old implementation of join_iterator (using Visual Studio 2012). add_const< int& >::type is still int&. We need to remove the reference first, then add const then re-add the reference. (Or find an altogether better solution :-)

comment:3 by Nathan Ridge, 9 years ago

(In [85400]) [range] Fixed a bug in join_iterator where joining a const range and a non-const range led to a compiler error (refs #8483).

comment:4 by Nathan Ridge, 9 years ago

Thanks! Fixed in trunk.

comment:5 by Neil Groves, 9 years ago

Owner: changed from Neil Groves to Nathan Ridge

Hi Nathan! I see you have fixed this in the trunk. When you are happy would you please merge this to release and then close this ticket?

comment:6 by Nathan Ridge, 9 years ago

Resolution: fixed
Status: newclosed

I have already merged it to the 'master' branch in git: https://github.com/boostorg/range/commit/4c2898345972bd6c44c6b55abb386af931cc8fb5. I guess I need to close the bug manually now that we use git (with svn I would put "fixes #8483" in the commit message of the merge and it would auto-close the bug).

Note: See TracTickets for help on using tickets.