Re: [Boost-bugs] [Boost C++ Libraries] #7376: join_iterator.hpp compiler warning

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #7376: join_iterator.hpp compiler warning
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-06-11 00:42:17

#7376: join_iterator.hpp compiler warning
  Reporter: Leonid Gershanovich <gleonid@…> | Owner: neilgroves
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: range
   Version: Boost 1.51.0 | Severity: Problem
Resolution: | Keywords:

Comment (by nathanridge):

 Replying to [comment:3 anonymous]:
> here is a sample code that produces compiler error:
> {{{
> #include "boost/range/join.hpp"
> struct A {};
> struct B: public A {} ;
> struct C: public A {};
> int main()
> {
> B b[10];
> C c[10];
> typedef ::boost::range_detail::join_iterator< const C*, const B* ,
 const A&, const A& > join_iterator;
> join_iterator it(::boost::make_iterator_range(c),
> ::boost::make_iterator_range(b),
> ::boost::range_detail::join_iterator_begin_tag());
> *it;
> }
> }}}
> '''''error''':''
> ''boost/range/detail/join_iterator.hpp:74:
> error: no match for ternary 'operator?:' in '(selected != 0u) ? *(const
 B*)((const boost::range_detail::join_iterator_union<const C*, const B*,
 const A&>*)this)->boost::range_detail::join_iterator_union<const C*, const
 B*, const A&>::m_it2 : *(const C*)((const
 boost::range_detail::join_iterator_union<const C*, const B*, const
 A&>*)this)->boost::range_detail::join_iterator_union<const C*, const B*,
 const A&>::m_it1'''
> with patch suggested earlier this sample compiles without errors.

 join_iterator is not part of the public interface of Boost.Range, it's
 just an implementation detail of boost::range::join().

 boost::range::join() currently requires that the value type of the second
 range be convertible to the value type of the first range. Perhaps this
 requirement could be relaxed, to allow cases where the two value types are
 convertible to a common type but not to each other, but then we need to
   1. get join_iterator to figure out what that common type is (which is
 possible in some cases like this one, but not in the general case); or
   2. provide a public interface for the user to specify this common type
 (right now you are specifying it by instantiating join_iterator with a
 custom Reference template parameter, which is not public interface)

 (or both).

 Your patch will probably be part of either solution, but I am inclined to
 wait until we have a complete solution before applying it.

Ticket URL: <>
Boost C++ Libraries <>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:13 UTC