Opened 7 years ago

Last modified 7 years ago

#11563 new Bugs

boost::range behavior changed from 1.55 to 1.56

Reported by: fiesh@… Owned by: Neil Groves
Milestone: To Be Determined Component: range
Version: Boost 1.59.0 Severity: Problem
Keywords: Cc:

Description

The following code sums up the problem, I think neither the behavior of <= 1.55 nor the one of >= 1.56 is desirable:

#include <boost/range/join.hpp>

#include <iostream>
#include <vector>

template <typename T>
void p(T const& t)
{
	for(const auto i: t) {
		std::cout << i << '\n';
	}
}

int main()
{
	std::vector<int> u(8, 0); // Make this const and it works.
	const std::vector<int> v(8, 0);
	p(boost::range::join(v, u)); // This does not work <= 1.55 but works >= 1.56
	p(boost::range::join(u, v)); // This does not work >= 1.56 but works <= 1.55

	return 0;
}

Also see http://melpon.org/wandbox/permlink/QuyJGrrLq3liyKDf for easier trial and error.

Change History (1)

comment:1 by Michel Morin, 7 years ago

Thanks for the report!

These behaviors were fixed in r85400 (i.e. the fix of #8483 -- Fix for reference type deduction in join_iterator.hpp), but the fix was (accidentally?) reverted in r85691. I suspect that the intention of r85691 would be to change

    typename add_reference<
        typename add_const<
            typename remove_reference<
                typename iterator_reference<Iterator2>::type
            >::type
        >::type
    >::type

to

    typename add_reference<
        typename add_const<
            typename remove_reference<
                typename iterator_reference<Iterator1>::type
            >::type
        >::type
    >::type

I made a PR on github.

Note: See TracTickets for help on using tickets.