Opened 7 years ago

Last modified 6 years ago

#11528 new Bugs

MSVS 2015 + boost::range: STL and Boost iterators

Reported by: Dennis Schneider <dsr@…> Owned by: Neil Groves
Milestone: To Be Determined Component: range
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:

Description

The attached test program compiled with MSVS 2013, but doesn't with MSVS2015 in debug mode and Boost-trunk as of 2015-08-05. The transform_iterator is recognised as Boost foward iterator, but only as STL input iterator because its reference type is int. Since boost::max_element uses std::max_element, it doesn't compile in debug mode with:

c:\program files (x86)\microsoft visual studio 14.0\vc\include\xutility(1005): error C2338: next requires forward iterator

I'd be happy if this code compiled and worked, or if otherwise the Boost assertion would fire because the transform iterator is not a Boost forward traversal iterator.

Attachments (2)

test.cpp (541 bytes ) - added by Dennis Schneider <dsr@…> 7 years ago.
Code in question
test-compile.txt (2.3 KB ) - added by Dennis Schneider <dsr@…> 7 years ago.
Compiler output

Download all attachments as: .zip

Change History (6)

by Dennis Schneider <dsr@…>, 7 years ago

Attachment: test.cpp added

Code in question

by Dennis Schneider <dsr@…>, 7 years ago

Attachment: test-compile.txt added

Compiler output

comment:1 by Michel Morin, 7 years ago

A possible fix would be to replace std::max_element with boost::first_max_element (in '<boost/algorithm/minmax_element.hpp>'). I'll make a PR on github soon.

The problems are still remaining for other algorithms that require more than InputIterator (of the standard iterator categories), though.

comment:2 by anonymous, 6 years ago

Hello, is there some update on this issue? I'm using Boost 1.60.0 and my project doesn't build with VS2015 debug mode with the same error message. Is it fixed in more recent boost releases?

comment:3 by Michel Morin, 6 years ago

PR was merged to 'develop' branch, but not merged to 'master' branch. So it is not yet fixed in the released versions of Boost.

comment:4 by anonymous, 6 years ago

Alternatively to using boost::first_max_element (it has some different signatures), one can substitute boost::range::min_element(x) with boost::range::min_element(x, std::greater<type_of_x>()). Useful if some input range has to be transformed. I didn't have such issues with min_element.

Note: See TracTickets for help on using tickets.