Boost logo

Boost :

Subject: [boost] Boost ICL tests attempting to pass non-bidirectional iterator to std::reverse_copy
From: Billy O'Neal (VC LIBS) (bion_at_[hidden])
Date: 2016-05-16 15:19:39


Hi folks.

I'm not a Boost.ICL expert, but we detected this one failure with our in-development STL and this test case:

template <ICL_IntervalSet_TEMPLATE(_T) IntervalSet, class T>
void interval_set_element_iter_4_discrete_types()
{
    typedef IntervalSet<T> IntervalSetT;
    typedef typename IntervalSetT::interval_type IntervalT;
    typedef std::vector<T> VectorT;

    IntervalSetT set_a;
    set_a.add(I_I(1,3)).add(I_I(6,7));

    VectorT vec(5), cev(5);
    vec[0]=MK_v(1);vec[1]=MK_v(2);vec[2]=MK_v(3);vec[3]=MK_v(6);vec[4]=MK_v(7);
    cev[0]=MK_v(7);cev[1]=MK_v(6);cev[2]=MK_v(3);cev[3]=MK_v(2);cev[4]=MK_v(1);

    VectorT dest;
    std::copy(elements_begin(set_a), elements_end(set_a), std::back_inserter(dest));
    BOOST_CHECK_EQUAL( vec == dest, true );

    dest.clear();
    std::copy(elements_rbegin(set_a), elements_rend(set_a), std::back_inserter(dest));
    BOOST_CHECK_EQUAL( cev == dest, true );

    dest.clear();
    std::reverse_copy(elements_begin(set_a), elements_end(set_a), std::back_inserter(dest));
    BOOST_CHECK_EQUAL( cev == dest, true );

    dest.clear();
    std::reverse_copy(elements_rbegin(set_a), elements_rend(set_a), std::back_inserter(dest));
    BOOST_CHECK_EQUAL( vec == dest, true );
}

which produces this failure:

C:\Dev\WCFB01_01\binaries\x86ret\inc\algorithm(1672): error C2665: 'std::_Reverse_copy1': none of the 2 overloads could convert all the argument types
C:\Dev\WCFB01_01\binaries\x86ret\inc\algorithm(1655): note: could be '_OutIt std::_Reverse_copy1<_Iter,_OutIt>(_BidIt,_BidIt,_OutIt,std::random_access_iterator_tag,std::random_access_iterator_tag)'
        with
        [
            _OutIt=std::back_insert_iterator<VectorT>,
            _Iter=boost::icl::element_iterator<std::_Tree_const_iterator<std::_Tree_val<std::_Tree_simple_types<boost::icl::discrete_interval<bicremental_type_5,std::less>>>>>,
            _BidIt=boost::icl::element_iterator<std::_Tree_const_iterator<std::_Tree_val<std::_Tree_simple_types<boost::icl::discrete_interval<bicremental_type_5,std::less>>>>>
        ]
C:\Dev\WCFB01_01\binaries\x86ret\inc\algorithm(1645): note: or '_OutIt std::_Reverse_copy1<_Iter,_OutIt>(_BidIt,_BidIt,_OutIt,std::bidirectional_iterator_tag,std::_Any_tag)'
        with
        [
            _OutIt=std::back_insert_iterator<VectorT>,
            _Iter=boost::icl::element_iterator<std::_Tree_const_iterator<std::_Tree_val<std::_Tree_simple_types<boost::icl::discrete_interval<bicremental_type_5,std::less>>>>>,
            _BidIt=boost::icl::element_iterator<std::_Tree_const_iterator<std::_Tree_val<std::_Tree_simple_types<boost::icl::discrete_interval<bicremental_type_5,std::less>>>>>
        ]
C:\Dev\WCFB01_01\binaries\x86ret\inc\algorithm(1672): note: while trying to match the argument list '(boost::icl::element_iterator<std::_Tree_const_iterator<std::_Tree_val<std::_Tree_simple_types<boost::icl::discrete_interval<DomainT,Compare>>>>>, boost::icl::element_iterator<std::_Tree_const_iterator<std::_Tree_val<std::_Tree_simple_types<boost::icl::discrete_interval<DomainT,Compare>>>>>, std::back_insert_iterator<VectorT>, boost::iterators::detail::iterator_category_with_traversal<std::input_iterator_tag,Traversal>, std::output_iterator_tag)'
        with
        [
            DomainT=bicremental_type_5,
            Compare=std::less
        ]
        and
        [
            DomainT=bicremental_type_5,
            Compare=std::less
        ]
        and
        [
            Traversal=boost::iterators::bidirectional_traversal_tag
        ]
c:\dev\wcfb01_01\src\qa\vc\fe\3rdpartycomp\boost_1_60_0\libs\icl\test\fastest_interval_set_\../test_interval_set_shared.hpp(810): note: see reference to function template instantiation '_OutIt std::reverse_copy<boost::icl::element_iterator<std::_Tree_const_iterator<std::_Tree_val<std::_Tree_simple_types<boost::icl::discrete_interval<DomainT,Compare>>>>>,std::back_insert_iterator<VectorT>>(_BidIt,_BidIt,_OutIt)' being compiled
        with
        [
            _OutIt=std::back_insert_iterator<VectorT>,
            DomainT=bicremental_type_5,
            Compare=std::less,
            _BidIt=boost::icl::element_iterator<std::_Tree_const_iterator<std::_Tree_val<std::_Tree_simple_types<boost::icl::discrete_interval<bicremental_type_5,std::less>>>>>
        ]
c:\dev\wcfb01_01\src\qa\vc\fe\3rdpartycomp\boost_1_60_0\libs\icl\test\fastest_interval_set_\../fastest_interval_set_cases.hpp(61): note: see reference to function template instantiation 'void interval_set_element_iter_4_discrete_types<boost::icl::interval_set,discrete_type_2>(void)' being compiled

We are considering reverting this enforcement of iterator category tag in our STL, but technically a standard library appears within its rights to reject this.

Billy Robert O'Neal III

SDE II - Visual C++ Libraries

bion_at_[hidden]


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk