2
0
mirror of https://github.com/boostorg/icl.git synced 2026-01-19 04:12:13 +00:00

fix syntax error for oder compilers

This commit is contained in:
jofaber
2018-06-11 17:54:58 +02:00
2 changed files with 36 additions and 0 deletions

View File

@@ -8,6 +8,7 @@ Copyright (c) 2010-2010: Joachim Faulhaber
#ifndef BOOST_ICL_CONCEPT_INTERVAL_ASSOCIATOR_HPP_JOFA_100920
#define BOOST_ICL_CONCEPT_INTERVAL_ASSOCIATOR_HPP_JOFA_100920
#include <boost/range/iterator_range.hpp>
#include <boost/icl/type_traits/domain_type_of.hpp>
#include <boost/icl/type_traits/interval_type_of.hpp>
#include <boost/icl/type_traits/is_combinable.hpp>
@@ -1161,6 +1162,30 @@ elements_end(const Type& object)
return typename Type::element_const_iterator(object.end());
}
template<class Type>
typename enable_if
<mpl::and_< is_interval_container<Type>
, mpl::not_<is_continuous_interval<typename Type::interval_type> > >,
iterator_range<typename Type::element_iterator> >::type
elements(Type& object)
{
return
make_iterator_range( typename Type::element_iterator(object.begin())
, typename Type::element_iterator(object.end()) );
}
template<class Type>
typename enable_if
<mpl::and_< is_interval_container<Type>
, mpl::not_<is_continuous_interval<typename Type::interval_type> > >,
iterator_range<typename Type::element_const_iterator> >::type
elements(Type const& object)
{
return
make_iterator_range( typename Type::element_const_iterator(object.begin())
, typename Type::element_const_iterator(object.end()) );
}
//--------------------------------------------------------------------------
//- Reverse
//--------------------------------------------------------------------------

View File

@@ -8,6 +8,7 @@ Copyright (c) 2008-2010: Joachim Faulhaber
#ifndef LIBS_ICL_TEST_TEST_INTERVAL_SET_SHARED_HPP_JOFA_080920
#define LIBS_ICL_TEST_TEST_INTERVAL_SET_SHARED_HPP_JOFA_080920
#include <boost/range/algorithm.hpp>
#include "portability.hpp"
template <ICL_IntervalSet_TEMPLATE(_T) IntervalSet, class T>
@@ -785,6 +786,7 @@ void interval_set_element_iter_4_discrete_types()
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;
// element iteration -----------------------------------------------------
std::copy(elements_begin(set_a), elements_end(set_a), std::back_inserter(dest));
BOOST_CHECK_EQUAL( vec == dest, true );
@@ -799,6 +801,15 @@ void interval_set_element_iter_4_discrete_types()
dest.clear();
std::reverse_copy(elements_rbegin(set_a), elements_rend(set_a), std::back_inserter(dest));
BOOST_CHECK_EQUAL( vec == dest, true );
// range based element iteration -----------------------------------------
dest.clear();
boost::copy(elements(set_a), std::back_inserter(dest));
BOOST_CHECK( vec == dest );
dest.clear();
boost::reverse_copy(elements(set_a), std::back_inserter(dest));
BOOST_CHECK( cev == dest );
}