diff options
author | robot-contrib <robot-contrib@yandex-team.com> | 2022-08-26 22:08:06 +0300 |
---|---|---|
committer | robot-contrib <robot-contrib@yandex-team.com> | 2022-08-26 22:08:06 +0300 |
commit | d063246f756e3568f11455a0a803363840797419 (patch) | |
tree | 407440ddea875ebd0d289369f20da703decc6ff1 | |
parent | c815af1186223677be77bf709c12468b01b29a3a (diff) | |
download | ydb-d063246f756e3568f11455a0a803363840797419.tar.gz |
Update contrib/restricted/boost/icl to 1.80.0
12 files changed, 429 insertions, 413 deletions
diff --git a/contrib/restricted/boost/icl/include/boost/icl/closed_interval.hpp b/contrib/restricted/boost/icl/include/boost/icl/closed_interval.hpp index a0278e8250a..d7a3e6f57a4 100644 --- a/contrib/restricted/boost/icl/include/boost/icl/closed_interval.hpp +++ b/contrib/restricted/boost/icl/include/boost/icl/closed_interval.hpp @@ -8,15 +8,19 @@ Copyright (c) 2010-2010: Joachim Faulhaber #ifndef BOOST_ICL_CLOSED_INTERVAL_HPP_JOFA_100324 #define BOOST_ICL_CLOSED_INTERVAL_HPP_JOFA_100324 +#include <functional> +#include <boost/static_assert.hpp> +#include <boost/concept/assert.hpp> #include <boost/icl/detail/concept_check.hpp> #include <boost/icl/concept/interval.hpp> +#include <boost/icl/type_traits/succ_pred.hpp> #include <boost/icl/type_traits/value_size.hpp> #include <boost/icl/type_traits/type_to_string.hpp> namespace boost{namespace icl { -template <class DomainT, +template <class DomainT, ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(ICL_COMPARE_DEFAULT, DomainT)> class closed_interval { @@ -30,8 +34,8 @@ public: //= Construct, copy, destruct //========================================================================== /** Default constructor; yields an empty interval <tt>[0,0)</tt>. */ - closed_interval() - : _lwb(unit_element<DomainT>::value()), _upb(identity_element<DomainT>::value()) + closed_interval() + : _lwb(unit_element<DomainT>::value()), _upb(identity_element<DomainT>::value()) { BOOST_CONCEPT_ASSERT((DefaultConstructibleConcept<DomainT>)); BOOST_CONCEPT_ASSERT((LessThanComparableConcept<DomainT>)); @@ -84,14 +88,14 @@ struct interval_traits< icl::closed_interval<DomainT, Compare> > return interval_type(lo, up); } - static domain_type lower(const interval_type& inter_val){ return inter_val.lower(); }; - static domain_type upper(const interval_type& inter_val){ return inter_val.upper(); }; + static domain_type lower(const interval_type& inter_val){ return inter_val.lower(); } + static domain_type upper(const interval_type& inter_val){ return inter_val.upper(); } }; //============================================================================== //= Type traits //============================================================================== -template <class DomainT, ICL_COMPARE Compare> +template <class DomainT, ICL_COMPARE Compare> struct interval_bound_type< closed_interval<DomainT,Compare> > { typedef interval_bound_type type; @@ -105,14 +109,13 @@ struct type_to_string<icl::closed_interval<DomainT,Compare> > { return "[I]<"+ type_to_string<DomainT>::apply() +">"; } }; -template<class DomainT> +template<class DomainT> struct value_size<icl::closed_interval<DomainT> > { - static std::size_t apply(const icl::closed_interval<DomainT>&) + static std::size_t apply(const icl::closed_interval<DomainT>&) { return 2; } }; }} // namespace icl boost #endif - diff --git a/contrib/restricted/boost/icl/include/boost/icl/concept/interval.hpp b/contrib/restricted/boost/icl/include/boost/icl/concept/interval.hpp index 10fa2fb8a76..91afe4fc6d0 100644 --- a/contrib/restricted/boost/icl/include/boost/icl/concept/interval.hpp +++ b/contrib/restricted/boost/icl/include/boost/icl/concept/interval.hpp @@ -9,7 +9,6 @@ Copyright (c) 2010-2010: Joachim Faulhaber #define BOOST_ICL_CONCEPT_INTERVAL_HPP_JOFA_100323 #include <boost/assert.hpp> -#include <boost/core/ignore_unused.hpp> #include <boost/utility/enable_if.hpp> #include <boost/mpl/and.hpp> #include <boost/mpl/or.hpp> @@ -30,6 +29,7 @@ Copyright (c) 2010-2010: Joachim Faulhaber #include <boost/icl/interval_traits.hpp> #include <boost/icl/dynamic_interval_traits.hpp> +#include <algorithm> namespace boost{namespace icl { @@ -39,7 +39,7 @@ namespace boost{namespace icl //============================================================================== template<class Type> inline typename enable_if<is_interval<Type>, bool>::type -domain_less(const typename interval_traits<Type>::domain_type& left, +domain_less(const typename interval_traits<Type>::domain_type& left, const typename interval_traits<Type>::domain_type& right) { return typename interval_traits<Type>::domain_compare()(left, right); @@ -47,7 +47,7 @@ domain_less(const typename interval_traits<Type>::domain_type& left, template<class Type> inline typename enable_if<is_interval<Type>, bool>::type -domain_less_equal(const typename interval_traits<Type>::domain_type& left, +domain_less_equal(const typename interval_traits<Type>::domain_type& left, const typename interval_traits<Type>::domain_type& right) { return !(typename interval_traits<Type>::domain_compare()(right, left)); @@ -55,7 +55,7 @@ domain_less_equal(const typename interval_traits<Type>::domain_type& left, template<class Type> inline typename enable_if<is_interval<Type>, bool>::type -domain_equal(const typename interval_traits<Type>::domain_type& left, +domain_equal(const typename interval_traits<Type>::domain_type& left, const typename interval_traits<Type>::domain_type& right) { typedef typename interval_traits<Type>::domain_compare domain_compare; @@ -65,7 +65,7 @@ domain_equal(const typename interval_traits<Type>::domain_type& left, template<class Type> inline typename enable_if< is_interval<Type> , typename interval_traits<Type>::domain_type>::type -domain_next(const typename interval_traits<Type>::domain_type value) +domain_next(const typename interval_traits<Type>::domain_type value) { typedef typename interval_traits<Type>::domain_type domain_type; typedef typename interval_traits<Type>::domain_compare domain_compare; @@ -75,7 +75,7 @@ domain_next(const typename interval_traits<Type>::domain_type value) template<class Type> inline typename enable_if< is_interval<Type> , typename interval_traits<Type>::domain_type>::type -domain_prior(const typename interval_traits<Type>::domain_type value) +domain_prior(const typename interval_traits<Type>::domain_type value) { typedef typename interval_traits<Type>::domain_type domain_type; typedef typename interval_traits<Type>::domain_compare domain_compare; @@ -110,10 +110,8 @@ singleton(const typename interval_traits<Type>::domain_type& value) //ASSERT: This always creates an interval with exactly one element typedef typename interval_traits<Type>::domain_type domain_type; typedef typename interval_traits<Type>::domain_compare domain_compare; - ignore_unused<domain_type, domain_compare>(); - BOOST_ASSERT((numeric_minimum<domain_type, domain_compare, is_numeric<domain_type>::value> - ::is_less_than(value) )); + ::is_less_than(value) )); return interval_traits<Type>::construct(domain_prior<Type>(value), value); } @@ -125,10 +123,8 @@ singleton(const typename interval_traits<Type>::domain_type& value) //ASSERT: This always creates an interval with exactly one element typedef typename interval_traits<Type>::domain_type domain_type; typedef typename interval_traits<Type>::domain_compare domain_compare; - ignore_unused<domain_type, domain_compare>(); - BOOST_ASSERT((numeric_minimum<domain_type, domain_compare, is_numeric<domain_type>::value> - ::is_less_than(value))); + ::is_less_than(value))); return interval_traits<Type>::construct( domain_prior<Type>(value) , domain_next<Type>(value)); @@ -154,10 +150,10 @@ namespace detail //============================================================================== //= Construct<Interval> unit_trail == generalized singleton -// The smallest interval on an incrementable (and decrementable) type that can +// The smallest interval on an incrementable (and decrementable) type that can // be constructed using ++ and -- and such that it contains a given value. -// If 'Type' is discrete, 'unit_trail' and 'singleton' are identical. So we -// can view 'unit_trail' as a generalized singleton for static intervals of +// If 'Type' is discrete, 'unit_trail' and 'singleton' are identical. So we +// can view 'unit_trail' as a generalized singleton for static intervals of // continuous types. //============================================================================== template<class Type> @@ -183,10 +179,8 @@ unit_trail(const typename interval_traits<Type>::domain_type& value) { typedef typename interval_traits<Type>::domain_type domain_type; typedef typename interval_traits<Type>::domain_compare domain_compare; - ignore_unused<domain_type, domain_compare>(); - BOOST_ASSERT((numeric_minimum<domain_type, domain_compare, is_numeric<domain_type>::value> - ::is_less_than(value) )); + ::is_less_than(value) )); return interval_traits<Type>::construct(domain_prior<Type>(value), value); } @@ -202,10 +196,8 @@ unit_trail(const typename interval_traits<Type>::domain_type& value) { typedef typename interval_traits<Type>::domain_type domain_type; typedef typename interval_traits<Type>::domain_compare domain_compare; - ignore_unused<domain_type, domain_compare>(); - BOOST_ASSERT((numeric_minimum<domain_type, domain_compare, is_numeric<domain_type>::value> - ::is_less_than(value))); + ::is_less_than(value))); return interval_traits<Type>::construct( domain_prior<Type>(value) , domain_next<Type>(value)); @@ -272,7 +264,8 @@ typename enable_if<is_interval<Type>, Type>::type span(const typename interval_traits<Type>::domain_type& left, const typename interval_traits<Type>::domain_type& right) { - if(interval_traits<Type>::domain_compare()(left,right)) + typedef typename interval_traits<Type>::domain_compare domain_compare; + if(domain_compare()(left,right)) return construct<Type>(left, right); else return construct<Type>(right, left); @@ -285,7 +278,8 @@ typename enable_if<is_static_right_open<Type>, Type>::type hull(const typename interval_traits<Type>::domain_type& left, const typename interval_traits<Type>::domain_type& right) { - if(interval_traits<Type>::domain_compare()(left,right)) + typedef typename interval_traits<Type>::domain_compare domain_compare; + if(domain_compare()(left,right)) return construct<Type>(left, domain_next<Type>(right)); else return construct<Type>(right, domain_next<Type>(left)); @@ -298,18 +292,16 @@ hull(const typename interval_traits<Type>::domain_type& left, { typedef typename interval_traits<Type>::domain_type domain_type; typedef typename interval_traits<Type>::domain_compare domain_compare; - ignore_unused<domain_type, domain_compare>(); - - if(interval_traits<Type>::domain_compare()(left,right)) + if(domain_compare()(left,right)) { BOOST_ASSERT((numeric_minimum<domain_type, domain_compare, is_numeric<domain_type>::value> - ::is_less_than(left) )); + ::is_less_than(left) )); return construct<Type>(domain_prior<Type>(left), right); } else { BOOST_ASSERT((numeric_minimum<domain_type, domain_compare, is_numeric<domain_type>::value> - ::is_less_than(right) )); + ::is_less_than(right) )); return construct<Type>(domain_prior<Type>(right), left); } } @@ -319,7 +311,8 @@ typename enable_if<is_static_closed<Type>, Type>::type hull(const typename interval_traits<Type>::domain_type& left, const typename interval_traits<Type>::domain_type& right) { - if(interval_traits<Type>::domain_compare()(left,right)) + typedef typename interval_traits<Type>::domain_compare domain_compare; + if(domain_compare()(left,right)) return construct<Type>(left, right); else return construct<Type>(right, left); @@ -332,19 +325,17 @@ hull(const typename interval_traits<Type>::domain_type& left, { typedef typename interval_traits<Type>::domain_type domain_type; typedef typename interval_traits<Type>::domain_compare domain_compare; - ignore_unused<domain_type, domain_compare>(); - - if(interval_traits<Type>::domain_compare()(left,right)) + if(domain_compare()(left,right)) { BOOST_ASSERT((numeric_minimum<domain_type, domain_compare, is_numeric<domain_type>::value> - ::is_less_than(left) )); + ::is_less_than(left) )); return construct<Type>( domain_prior<Type>(left) , domain_next<Type>(right)); } else { BOOST_ASSERT((numeric_minimum<domain_type, domain_compare, is_numeric<domain_type>::value> - ::is_less_than(right) )); + ::is_less_than(right) )); return construct<Type>( domain_prior<Type>(right) , domain_next<Type>(left)); } @@ -355,7 +346,8 @@ typename enable_if<has_dynamic_bounds<Type>, Type>::type hull(const typename interval_traits<Type>::domain_type& left, const typename interval_traits<Type>::domain_type& right) { - if(interval_traits<Type>::domain_compare()(left,right)) + typedef typename interval_traits<Type>::domain_compare domain_compare; + if(domain_compare()(left,right)) return construct<Type>(left, right, interval_bounds::closed()); else return construct<Type>(right, left, interval_bounds::closed()); @@ -366,164 +358,160 @@ hull(const typename interval_traits<Type>::domain_type& left, //============================================================================== template<class Type> -inline typename enable_if<is_interval<Type>, +inline typename enable_if<is_interval<Type>, typename interval_traits<Type>::domain_type>::type lower(const Type& object) -{ +{ return interval_traits<Type>::lower(object); } template<class Type> -inline typename enable_if<is_interval<Type>, +inline typename enable_if<is_interval<Type>, typename interval_traits<Type>::domain_type>::type upper(const Type& object) -{ +{ return interval_traits<Type>::upper(object); } //- first ---------------------------------------------------------------------- template<class Type> -inline typename +inline typename enable_if< mpl::or_<is_static_right_open<Type>, is_static_closed<Type> > , typename interval_traits<Type>::domain_type>::type first(const Type& object) -{ +{ return lower(object); } template<class Type> -inline typename +inline typename enable_if< mpl::and_< mpl::or_<is_static_left_open<Type>, is_static_open<Type> > , is_discrete<typename interval_traits<Type>::domain_type> > , typename interval_traits<Type>::domain_type>::type first(const Type& object) -{ +{ return domain_next<Type>(lower(object)); } template<class Type> -inline typename enable_if<is_discrete_interval<Type>, +inline typename enable_if<is_discrete_interval<Type>, typename interval_traits<Type>::domain_type>::type first(const Type& object) -{ - return is_left_closed(object.bounds()) ? - lower(object) : +{ + return is_left_closed(object.bounds()) ? + lower(object) : domain_next<Type>(lower(object)); } //- last ----------------------------------------------------------------------- template<class Type> -inline typename +inline typename enable_if< mpl::or_<is_static_left_open<Type>, is_static_closed<Type> > , typename interval_traits<Type>::domain_type>::type last(const Type& object) -{ +{ return upper(object); } template<class Type> -inline typename +inline typename enable_if< mpl::and_< mpl::or_<is_static_right_open<Type>, is_static_open<Type> > , is_discrete<typename interval_traits<Type>::domain_type> > , typename interval_traits<Type>::domain_type>::type last(const Type& object) -{ +{ typedef typename interval_traits<Type>::domain_type domain_type; typedef typename interval_traits<Type>::domain_compare domain_compare; - ignore_unused<domain_type, domain_compare>(); - BOOST_ASSERT((numeric_minimum<domain_type, domain_compare, is_numeric<domain_type>::value> - ::is_less_than(upper(object)) )); + ::is_less_than(upper(object)) )); return domain_prior<Type>(upper(object)); } template<class Type> -inline typename enable_if<is_discrete_interval<Type>, +inline typename enable_if<is_discrete_interval<Type>, typename interval_traits<Type>::domain_type>::type last(const Type& object) -{ +{ typedef typename interval_traits<Type>::domain_type domain_type; typedef typename interval_traits<Type>::domain_compare domain_compare; - ignore_unused<domain_type, domain_compare>(); - BOOST_ASSERT((numeric_minimum<domain_type, domain_compare, is_numeric<domain_type>::value> - ::is_less_than_or(upper(object), is_right_closed(object.bounds())) )); - return is_right_closed(object.bounds()) ? - upper(object) : + ::is_less_than_or(upper(object), is_right_closed(object.bounds())) )); + return is_right_closed(object.bounds()) ? + upper(object) : domain_prior<Type>(upper(object)); } //- last_next ------------------------------------------------------------------ template<class Type> -inline typename +inline typename enable_if< mpl::and_< mpl::or_<is_static_left_open<Type>, is_static_closed<Type> > , is_discrete<typename interval_traits<Type>::domain_type> > , typename interval_traits<Type>::domain_type>::type last_next(const Type& object) -{ +{ return domain_next<Type>(upper(object)); } template<class Type> -inline typename +inline typename enable_if< mpl::and_< mpl::or_<is_static_right_open<Type>, is_static_open<Type> > , is_discrete<typename interval_traits<Type>::domain_type> > , typename interval_traits<Type>::domain_type>::type last_next(const Type& object) -{ +{ //CL typedef typename interval_traits<Type>::domain_type domain_type; return upper(object); // NOTE: last_next is implemented to avoid calling pred(object) } // For unsigned integral types this may cause underflow. template<class Type> -inline typename enable_if<is_discrete_interval<Type>, +inline typename enable_if<is_discrete_interval<Type>, typename interval_traits<Type>::domain_type>::type last_next(const Type& object) -{ - return is_right_closed(object.bounds()) ? - domain_next<Type>(upper(object)): +{ + return is_right_closed(object.bounds()) ? + domain_next<Type>(upper(object)): upper(object) ; } //------------------------------------------------------------------------------ template<class Type> -typename enable_if<has_dynamic_bounds<Type>, +typename enable_if<has_dynamic_bounds<Type>, typename Type::bounded_domain_type>::type bounded_lower(const Type& object) -{ - return typename - Type::bounded_domain_type(lower(object), object.bounds().left()); +{ + return typename + Type::bounded_domain_type(lower(object), object.bounds().left()); } template<class Type> -typename enable_if<has_dynamic_bounds<Type>, +typename enable_if<has_dynamic_bounds<Type>, typename Type::bounded_domain_type>::type reverse_bounded_lower(const Type& object) -{ - return typename - Type::bounded_domain_type(lower(object), - object.bounds().reverse_left()); +{ + return typename + Type::bounded_domain_type(lower(object), + object.bounds().reverse_left()); } template<class Type> -typename enable_if<has_dynamic_bounds<Type>, +typename enable_if<has_dynamic_bounds<Type>, typename Type::bounded_domain_type>::type bounded_upper(const Type& object) -{ - return typename - Type::bounded_domain_type(upper(object), - object.bounds().right()); +{ + return typename + Type::bounded_domain_type(upper(object), + object.bounds().right()); } template<class Type> -typename enable_if<has_dynamic_bounds<Type>, +typename enable_if<has_dynamic_bounds<Type>, typename Type::bounded_domain_type>::type reverse_bounded_upper(const Type& object) -{ - return typename - Type::bounded_domain_type(upper(object), - object.bounds().reverse_right()); +{ + return typename + Type::bounded_domain_type(upper(object), + object.bounds().reverse_right()); } //- bounds --------------------------------------------------------------------- @@ -549,36 +537,36 @@ bounds(const Type&) template<class Type> typename boost::enable_if<is_asymmetric_interval<Type>, bool>::type is_empty(const Type& object) -{ - return domain_less_equal<Type>(upper(object), lower(object)); +{ + return domain_less_equal<Type>(upper(object), lower(object)); } template<class Type> typename boost::enable_if<is_static_closed<Type>, bool>::type is_empty(const Type& object) -{ - return domain_less<Type>(upper(object), lower(object)); +{ + return domain_less<Type>(upper(object), lower(object)); } template<class Type> typename boost::enable_if<is_static_open<Type>, bool>::type is_empty(const Type& object) -{ - return domain_less_equal<Type>(upper(object), lower(object) ) +{ + return domain_less_equal<Type>(upper(object), lower(object) ) || domain_less_equal<Type>(upper(object), domain_next<Type>(lower(object))); } template<class Type> typename boost::enable_if<is_discrete_interval<Type>, bool>::type is_empty(const Type& object) -{ +{ if(object.bounds() == interval_bounds::closed()) - return domain_less<Type>(upper(object), lower(object)); + return domain_less<Type>(upper(object), lower(object)); else if(object.bounds() == interval_bounds::open()) return domain_less_equal<Type>(upper(object), lower(object) ) || domain_less_equal<Type>(upper(object), domain_next<Type>(lower(object))); else - return domain_less_equal<Type>(upper(object), lower(object)); + return domain_less_equal<Type>(upper(object), lower(object)); } template<class Type> @@ -591,147 +579,40 @@ is_empty(const Type& object) } //============================================================================== -//= Orderings, containedness (non empty) -//============================================================================== -namespace non_empty -{ - - template<class Type> - inline typename boost::enable_if<is_asymmetric_interval<Type>, bool>::type - exclusive_less(const Type& left, const Type& right) - { - BOOST_ASSERT(!(icl::is_empty(left) || icl::is_empty(right))); - return domain_less_equal<Type>(upper(left), lower(right)); - } - - template<class Type> - inline typename boost::enable_if<is_discrete_interval<Type>, bool>::type - exclusive_less(const Type& left, const Type& right) - { - BOOST_ASSERT(!(icl::is_empty(left) || icl::is_empty(right))); - return domain_less<Type>(last(left), first(right)); - } - - template<class Type> - inline typename boost:: - enable_if<has_symmetric_bounds<Type>, bool>::type - exclusive_less(const Type& left, const Type& right) - { - BOOST_ASSERT(!(icl::is_empty(left) || icl::is_empty(right))); - return domain_less<Type>(last(left), first(right)); - } - - template<class Type> - inline typename boost::enable_if<is_continuous_interval<Type>, bool>::type - exclusive_less(const Type& left, const Type& right) - { - BOOST_ASSERT(!(icl::is_empty(left) || icl::is_empty(right))); - return domain_less <Type>(upper(left), lower(right)) - || ( domain_equal<Type>(upper(left), lower(right)) - && inner_bounds(left,right) != interval_bounds::open() ); - } - - template<class Type> - inline typename boost::enable_if<is_interval<Type>, bool>::type - contains(const Type& super, const Type& sub) - { - return lower_less_equal(super,sub) && upper_less_equal(sub,super); - } - - -} //namespace non_empty - - -//- contains ------------------------------------------------------------------- -template<class Type> -inline typename boost::enable_if<is_interval<Type>, bool>::type -contains(const Type& super, const Type& sub) -{ - return icl::is_empty(sub) || non_empty::contains(super, sub); -} - -template<class Type> -typename boost::enable_if<is_discrete_static<Type>, bool>::type -contains(const Type& super, const typename interval_traits<Type>::domain_type& element) -{ - return domain_less_equal<Type>(icl::first(super), element ) - && domain_less_equal<Type>( element, icl::last(super)); -} - -template<class Type> -typename boost::enable_if<is_continuous_left_open<Type>, bool>::type -contains(const Type& super, const typename interval_traits<Type>::domain_type& element) -{ - return domain_less <Type>(icl::lower(super), element ) - && domain_less_equal<Type>( element, icl::upper(super)); -} - -template<class Type> -typename boost::enable_if<is_continuous_right_open<Type>, bool>::type -contains(const Type& super, const typename interval_traits<Type>::domain_type& element) -{ - return domain_less_equal<Type>(icl::lower(super), element ) - && domain_less <Type>( element, icl::upper(super)); -} - -template<class Type> -typename boost::enable_if<has_dynamic_bounds<Type>, bool>::type -contains(const Type& super, const typename interval_traits<Type>::domain_type& element) -{ - return - (is_left_closed(super.bounds()) - ? domain_less_equal<Type>(lower(super), element) - : domain_less<Type>(lower(super), element)) - && - (is_right_closed(super.bounds()) - ? domain_less_equal<Type>(element, upper(super)) - : domain_less<Type>(element, upper(super))); -} - -//- within --------------------------------------------------------------------- -template<class Type> -inline typename boost::enable_if<is_interval<Type>, bool>::type -within(const Type& sub, const Type& super) -{ - return contains(super,sub); -} - - -//============================================================================== //= Equivalences and Orderings //============================================================================== //- exclusive_less ------------------------------------------------------------- -/** Maximal element of <tt>left</tt> is less than the minimal element of +/** Maximal element of <tt>left</tt> is less than the minimal element of <tt>right</tt> */ template<class Type> inline typename boost::enable_if<is_asymmetric_interval<Type>, bool>::type exclusive_less(const Type& left, const Type& right) -{ +{ return icl::is_empty(left) || icl::is_empty(right) - || domain_less_equal<Type>(upper(left), lower(right)); + || domain_less_equal<Type>(upper(left), lower(right)); } template<class Type> inline typename boost::enable_if<is_discrete_interval<Type>, bool>::type exclusive_less(const Type& left, const Type& right) -{ +{ return icl::is_empty(left) || icl::is_empty(right) - || domain_less<Type>(last(left), first(right)); + || domain_less<Type>(last(left), first(right)); } template<class Type> inline typename boost:: enable_if<has_symmetric_bounds<Type>, bool>::type exclusive_less(const Type& left, const Type& right) -{ +{ return icl::is_empty(left) || icl::is_empty(right) - || domain_less<Type>(last(left), first(right)); + || domain_less<Type>(last(left), first(right)); } template<class Type> inline typename boost::enable_if<is_continuous_interval<Type>, bool>::type exclusive_less(const Type& left, const Type& right) -{ +{ return icl::is_empty(left) || icl::is_empty(right) || domain_less<Type>(upper(left), lower(right)) || ( domain_equal<Type>(upper(left), lower(right)) @@ -746,24 +627,24 @@ lower_less(const Type& left, const Type& right) { return domain_less<Type>(lower(left), lower(right)); } - + template<class Type> typename boost::enable_if<is_discrete_interval<Type>, bool>::type lower_less(const Type& left, const Type& right) { return domain_less<Type>(first(left), first(right)); } - + template<class Type> typename boost::enable_if<is_continuous_interval<Type>, bool>::type lower_less(const Type& left, const Type& right) { if(left_bounds(left,right) == interval_bounds::right_open()) //'[(' == 10 return domain_less_equal<Type>(lower(left), lower(right)); - else + else return domain_less<Type>(lower(left), lower(right)); } - + //------------------------------------------------------------------------------ template<class Type> @@ -779,7 +660,7 @@ upper_less(const Type& left, const Type& right) { return domain_less<Type>(last(left), last(right)); } - + template<class Type> typename boost::enable_if<is_continuous_interval<Type>, bool>::type upper_less(const Type& left, const Type& right) @@ -789,10 +670,10 @@ upper_less(const Type& left, const Type& right) else return domain_less<Type>(upper(left), upper(right)); } - + //------------------------------------------------------------------------------ template<class Type> -typename boost::enable_if<has_dynamic_bounds<Type>, +typename boost::enable_if<has_dynamic_bounds<Type>, typename Type::bounded_domain_type >::type lower_min(const Type& left, const Type& right) { @@ -801,7 +682,7 @@ lower_min(const Type& left, const Type& right) //------------------------------------------------------------------------------ template<class Type> -typename boost::enable_if<has_dynamic_bounds<Type>, +typename boost::enable_if<has_dynamic_bounds<Type>, typename Type::bounded_domain_type >::type lower_max(const Type& left, const Type& right) { @@ -810,7 +691,7 @@ lower_max(const Type& left, const Type& right) //------------------------------------------------------------------------------ template<class Type> -typename boost::enable_if<has_dynamic_bounds<Type>, +typename boost::enable_if<has_dynamic_bounds<Type>, typename Type::bounded_domain_type >::type upper_max(const Type& left, const Type& right) { @@ -819,7 +700,7 @@ upper_max(const Type& left, const Type& right) //------------------------------------------------------------------------------ template<class Type> -typename boost::enable_if<has_dynamic_bounds<Type>, +typename boost::enable_if<has_dynamic_bounds<Type>, typename Type::bounded_domain_type >::type upper_min(const Type& left, const Type& right) { @@ -903,13 +784,116 @@ upper_less_equal(const Type& left, const Type& right) return upper_less(left,right) || upper_equal(left,right); } +//============================================================================== +//= Orderings, containedness (non empty) +//============================================================================== +namespace non_empty +{ + + template<class Type> + inline typename boost::enable_if<is_asymmetric_interval<Type>, bool>::type + exclusive_less(const Type& left, const Type& right) + { + BOOST_ASSERT(!(icl::is_empty(left) || icl::is_empty(right))); + return domain_less_equal<Type>(upper(left), lower(right)); + } + + template<class Type> + inline typename boost::enable_if<is_discrete_interval<Type>, bool>::type + exclusive_less(const Type& left, const Type& right) + { + BOOST_ASSERT(!(icl::is_empty(left) || icl::is_empty(right))); + return domain_less<Type>(last(left), first(right)); + } + + template<class Type> + inline typename boost:: + enable_if<has_symmetric_bounds<Type>, bool>::type + exclusive_less(const Type& left, const Type& right) + { + BOOST_ASSERT(!(icl::is_empty(left) || icl::is_empty(right))); + return domain_less<Type>(last(left), first(right)); + } + + template<class Type> + inline typename boost::enable_if<is_continuous_interval<Type>, bool>::type + exclusive_less(const Type& left, const Type& right) + { + BOOST_ASSERT(!(icl::is_empty(left) || icl::is_empty(right))); + return domain_less <Type>(upper(left), lower(right)) + || ( domain_equal<Type>(upper(left), lower(right)) + && inner_bounds(left,right) != interval_bounds::open() ); + } + + template<class Type> + inline typename boost::enable_if<is_interval<Type>, bool>::type + contains(const Type& super, const Type& sub) + { + return lower_less_equal(super,sub) && upper_less_equal(sub,super); + } + +} //namespace non_empty + +//- contains ------------------------------------------------------------------- +template<class Type> +inline typename boost::enable_if<is_interval<Type>, bool>::type +contains(const Type& super, const Type& sub) +{ + return icl::is_empty(sub) || non_empty::contains(super, sub); +} + +template<class Type> +typename boost::enable_if<is_discrete_static<Type>, bool>::type +contains(const Type& super, const typename interval_traits<Type>::domain_type& element) +{ + return domain_less_equal<Type>(icl::first(super), element ) + && domain_less_equal<Type>( element, icl::last(super)); +} + +template<class Type> +typename boost::enable_if<is_continuous_left_open<Type>, bool>::type +contains(const Type& super, const typename interval_traits<Type>::domain_type& element) +{ + return domain_less <Type>(icl::lower(super), element ) + && domain_less_equal<Type>( element, icl::upper(super)); +} + +template<class Type> +typename boost::enable_if<is_continuous_right_open<Type>, bool>::type +contains(const Type& super, const typename interval_traits<Type>::domain_type& element) +{ + return domain_less_equal<Type>(icl::lower(super), element ) + && domain_less <Type>( element, icl::upper(super)); +} + +template<class Type> +typename boost::enable_if<has_dynamic_bounds<Type>, bool>::type +contains(const Type& super, const typename interval_traits<Type>::domain_type& element) +{ + return + (is_left_closed(super.bounds()) + ? domain_less_equal<Type>(lower(super), element) + : domain_less<Type>(lower(super), element)) + && + (is_right_closed(super.bounds()) + ? domain_less_equal<Type>(element, upper(super)) + : domain_less<Type>(element, upper(super))); +} + +//- within --------------------------------------------------------------------- +template<class Type> +inline typename boost::enable_if<is_interval<Type>, bool>::type +within(const Type& sub, const Type& super) +{ + return contains(super,sub); +} //- operator == ---------------------------------------------------------------- template<class Type> typename boost::enable_if<is_interval<Type>, bool>::type operator == (const Type& left, const Type& right) { - return (icl::is_empty(left) && icl::is_empty(right)) + return (icl::is_empty(left) && icl::is_empty(right)) || (lower_equal(left,right) && upper_equal(left,right)); } @@ -925,11 +909,11 @@ template<class Type> typename boost::enable_if<is_interval<Type>, bool>::type operator < (const Type& left, const Type& right) { - if(icl::is_empty(left)) + if(icl::is_empty(left)) return !icl::is_empty(right); - else - return lower_less(left,right) - || (lower_equal(left,right) && upper_less(left,right)); + else + return lower_less(left,right) + || (lower_equal(left,right) && upper_less(left,right)); } template<class Type> @@ -945,15 +929,15 @@ operator > (const Type& left, const Type& right) template<class Type> typename boost::enable_if<is_asymmetric_interval<Type>, bool>::type touches(const Type& left, const Type& right) -{ - return domain_equal<Type>(upper(left), lower(right)); +{ + return domain_equal<Type>(upper(left), lower(right)); } template<class Type> typename boost::enable_if<has_symmetric_bounds<Type>, bool>::type touches(const Type& left, const Type& right) -{ - return domain_equal<Type>(last_next(left), first(right)); +{ + return domain_equal<Type>(last_next(left), first(right)); } template<class Type> @@ -978,22 +962,22 @@ touches(const Type& left, const Type& right) //- cardinality ---------------------------------------------------------------- template<class Type> -typename boost::enable_if<is_continuous_interval<Type>, +typename boost::enable_if<is_continuous_interval<Type>, typename size_type_of<interval_traits<Type> >::type>::type cardinality(const Type& object) { typedef typename size_type_of<interval_traits<Type> >::type SizeT; if(icl::is_empty(object)) return icl::identity_element<SizeT>::value(); - else if( object.bounds() == interval_bounds::closed() + else if( object.bounds() == interval_bounds::closed() && domain_equal<Type>(lower(object), upper(object))) return icl::unit_element<SizeT>::value(); - else + else return icl::infinity<SizeT>::value(); } template<class Type> -typename boost::enable_if<is_discrete_interval<Type>, +typename boost::enable_if<is_discrete_interval<Type>, typename size_type_of<interval_traits<Type> >::type>::type cardinality(const Type& object) { @@ -1003,19 +987,19 @@ cardinality(const Type& object) } template<class Type> -typename boost::enable_if<is_continuous_asymmetric<Type>, +typename boost::enable_if<is_continuous_asymmetric<Type>, typename size_type_of<interval_traits<Type> >::type>::type cardinality(const Type& object) { typedef typename size_type_of<interval_traits<Type> >::type SizeT; if(icl::is_empty(object)) return icl::identity_element<SizeT>::value(); - else + else return icl::infinity<SizeT>::value(); } template<class Type> -typename boost::enable_if<is_discrete_asymmetric<Type>, +typename boost::enable_if<is_discrete_asymmetric<Type>, typename size_type_of<interval_traits<Type> >::type>::type cardinality(const Type& object) { @@ -1025,7 +1009,7 @@ cardinality(const Type& object) } template<class Type> -typename boost::enable_if<has_symmetric_bounds<Type>, +typename boost::enable_if<has_symmetric_bounds<Type>, typename size_type_of<interval_traits<Type> >::type>::type cardinality(const Type& object) { @@ -1038,7 +1022,7 @@ cardinality(const Type& object) //- size ----------------------------------------------------------------------- template<class Type> -inline typename enable_if<is_interval<Type>, +inline typename enable_if<is_interval<Type>, typename size_type_of<interval_traits<Type> >::type>::type size(const Type& object) { @@ -1047,7 +1031,7 @@ size(const Type& object) //- length --------------------------------------------------------------------- template<class Type> -inline typename boost::enable_if<is_continuous_interval<Type>, +inline typename boost::enable_if<is_continuous_interval<Type>, typename difference_type_of<interval_traits<Type> >::type>::type length(const Type& object) { @@ -1057,7 +1041,7 @@ length(const Type& object) } template<class Type> -inline typename boost::enable_if<is_discrete_interval<Type>, +inline typename boost::enable_if<is_discrete_interval<Type>, typename difference_type_of<interval_traits<Type> >::type>::type length(const Type& object) { @@ -1067,7 +1051,7 @@ length(const Type& object) } template<class Type> -typename boost::enable_if<is_continuous_asymmetric<Type>, +typename boost::enable_if<is_continuous_asymmetric<Type>, typename difference_type_of<interval_traits<Type> >::type>::type length(const Type& object) { @@ -1077,7 +1061,7 @@ length(const Type& object) } template<class Type> -inline typename boost::enable_if<is_discrete_static<Type>, +inline typename boost::enable_if<is_discrete_static<Type>, typename difference_type_of<interval_traits<Type> >::type>::type length(const Type& object) { @@ -1088,7 +1072,7 @@ length(const Type& object) //- iterative_size ------------------------------------------------------------- template<class Type> -inline typename enable_if<is_interval<Type>, +inline typename enable_if<is_interval<Type>, typename size_type_of<interval_traits<Type> >::type>::type iterative_size(const Type&) { @@ -1112,10 +1096,10 @@ hull(Type left, const Type& right) else if(icl::is_empty(left)) return right; - return + return construct<Type> ( - (std::min)(lower(left), lower(right), domain_compare()), + (std::min)(lower(left), lower(right), domain_compare()), (std::max)(upper(left), upper(right), domain_compare()) ); } @@ -1131,7 +1115,7 @@ hull(Type left, const Type& right) return dynamic_interval_traits<Type>::construct_bounded ( - lower_min(left, right), + lower_min(left, right), upper_max(left, right) ); } @@ -1140,7 +1124,7 @@ hull(Type left, const Type& right) //= Subtraction //============================================================================== //- left_subtract -------------------------------------------------------------- -/** subtract \c left_minuend from the \c right interval on it's left side. +/** subtract \c left_minuend from the \c right interval on it's left side. Return the difference: The part of \c right right of \c left_minuend. \code right_over = right - left_minuend; //on the left. @@ -1154,7 +1138,7 @@ typename boost::enable_if<is_asymmetric_interval<Type>, Type>::type left_subtract(Type right, const Type& left_minuend) { if(exclusive_less(left_minuend, right)) - return right; + return right; return construct<Type>(upper(left_minuend), upper(right)); } @@ -1164,7 +1148,7 @@ typename boost::enable_if<is_static_closed<Type>, Type>::type left_subtract(Type right, const Type& left_minuend) { if(exclusive_less(left_minuend, right)) - return right; + return right; else if(upper_less_equal(right, left_minuend)) return identity_element<Type>::value(); @@ -1176,7 +1160,7 @@ typename boost::enable_if<is_static_open<Type>, Type>::type left_subtract(Type right, const Type& left_minuend) { if(exclusive_less(left_minuend, right)) - return right; + return right; return construct<Type>(domain_prior<Type>(upper(left_minuend)), upper(right)); } @@ -1186,14 +1170,14 @@ typename boost::enable_if<has_dynamic_bounds<Type>, Type>::type left_subtract(Type right, const Type& left_minuend) { if(exclusive_less(left_minuend, right)) - return right; + return right; return dynamic_interval_traits<Type>::construct_bounded ( reverse_bounded_upper(left_minuend), bounded_upper(right) ); } //- right_subtract ------------------------------------------------------------- -/** subtract \c right_minuend from the \c left interval on it's right side. +/** subtract \c right_minuend from the \c left interval on it's right side. Return the difference: The part of \c left left of \c right_minuend. \code left_over = left - right_minuend; //on the right side. @@ -1207,7 +1191,7 @@ typename boost::enable_if<is_asymmetric_interval<Type>, Type>::type right_subtract(Type left, const Type& right_minuend) { if(exclusive_less(left, right_minuend)) - return left; + return left; return construct<Type>(lower(left), lower(right_minuend)); } @@ -1238,7 +1222,7 @@ typename boost::enable_if<has_dynamic_bounds<Type>, Type>::type right_subtract(Type left, const Type& right_minuend) { if(exclusive_less(left, right_minuend)) - return left; + return left; return dynamic_interval_traits<Type>::construct_bounded ( bounded_lower(left), reverse_bounded_lower(right_minuend) ); @@ -1289,11 +1273,11 @@ operator & (Type left, const Type& right) { if(icl::is_empty(left) || icl::is_empty(right)) return identity_element<Type>::value(); - else + else return dynamic_interval_traits<Type>::construct_bounded ( - lower_max(left, right), - upper_min(left, right) + lower_max(left, right), + upper_min(left, right) ); } @@ -1302,18 +1286,18 @@ operator & (Type left, const Type& right) template<class Type> typename boost::enable_if<is_interval<Type>, bool>::type intersects(const Type& left, const Type& right) -{ - return !( icl::is_empty(left) || icl::is_empty(right) - || exclusive_less(left,right) || exclusive_less(right,left)); +{ + return !( icl::is_empty(left) || icl::is_empty(right) + || exclusive_less(left,right) || exclusive_less(right,left)); } //- disjoint ------------------------------------------------------------------- template<class Type> typename boost::enable_if<is_interval<Type>, bool>::type disjoint(const Type& left, const Type& right) -{ - return icl::is_empty(left) || icl::is_empty(right) - || exclusive_less(left,right) || exclusive_less(right,left); +{ + return icl::is_empty(left) || icl::is_empty(right) + || exclusive_less(left,right) || exclusive_less(right,left); } //============================================================================== @@ -1379,7 +1363,7 @@ inner_complement(const Type& left, const Type& right) template<class Type> inline typename boost::enable_if<is_interval<Type>, Type>::type between(const Type& left, const Type& right) -{ +{ return inner_complement(left, right); } @@ -1392,7 +1376,7 @@ template<class Type> typename boost:: enable_if< mpl::and_< is_interval<Type> , has_difference<typename interval_traits<Type>::domain_type> - , is_discrete<typename interval_traits<Type>::domain_type> + , is_discrete<typename interval_traits<Type>::domain_type> > , typename difference_type_of<interval_traits<Type> >::type>::type distance(const Type& x1, const Type& x2) @@ -1413,7 +1397,7 @@ template<class Type> typename boost:: enable_if< mpl::and_< is_interval<Type> , has_difference<typename interval_traits<Type>::domain_type> - , is_continuous<typename interval_traits<Type>::domain_type> + , is_continuous<typename interval_traits<Type>::domain_type> > , typename difference_type_of<interval_traits<Type> >::type>::type distance(const Type& x1, const Type& x2) @@ -1447,9 +1431,9 @@ left_bracket(const Type&) { return "["; } template<class Type> typename boost::enable_if<has_dynamic_bounds<Type>, std::string>::type -left_bracket(const Type& object) -{ - return left_bracket(object.bounds()); +left_bracket(const Type& object) +{ + return left_bracket(object.bounds()); } //------------------------------------------------------------------------------ @@ -1467,28 +1451,27 @@ right_bracket(const Type&) { return "]"; } template<class Type> typename boost::enable_if<has_dynamic_bounds<Type>, std::string>::type -right_bracket(const Type& object) -{ - return right_bracket(object.bounds()); +right_bracket(const Type& object) +{ + return right_bracket(object.bounds()); } //------------------------------------------------------------------------------ template<class CharType, class CharTraits, class Type> -typename boost::enable_if<is_interval<Type>, +typename boost::enable_if<is_interval<Type>, std::basic_ostream<CharType, CharTraits> >::type& operator << (std::basic_ostream<CharType, CharTraits> &stream, Type const& object) { if(boost::icl::is_empty(object)) - return stream << left_bracket<Type>(object) << right_bracket<Type>(object); + return stream << left_bracket<Type>(object) << right_bracket<Type>(object); else - return stream << left_bracket<Type>(object) - << interval_traits<Type>::lower(object) - << "," - << interval_traits<Type>::upper(object) + return stream << left_bracket<Type>(object) + << interval_traits<Type>::lower(object) + << "," + << interval_traits<Type>::upper(object) << right_bracket<Type>(object) ; } }} // namespace icl boost #endif - diff --git a/contrib/restricted/boost/icl/include/boost/icl/concept/interval_associator.hpp b/contrib/restricted/boost/icl/include/boost/icl/concept/interval_associator.hpp index 5ffbe6256b5..12377bb173a 100644 --- a/contrib/restricted/boost/icl/include/boost/icl/concept/interval_associator.hpp +++ b/contrib/restricted/boost/icl/include/boost/icl/concept/interval_associator.hpp @@ -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 //-------------------------------------------------------------------------- diff --git a/contrib/restricted/boost/icl/include/boost/icl/continuous_interval.hpp b/contrib/restricted/boost/icl/include/boost/icl/continuous_interval.hpp index 3015a1d13d3..1224d4018fc 100644 --- a/contrib/restricted/boost/icl/include/boost/icl/continuous_interval.hpp +++ b/contrib/restricted/boost/icl/include/boost/icl/continuous_interval.hpp @@ -101,8 +101,8 @@ struct interval_traits< icl::continuous_interval<DomainT, Compare> > return interval_type(lo, up); } - static domain_type lower(const interval_type& inter_val){ return inter_val.lower(); }; - static domain_type upper(const interval_type& inter_val){ return inter_val.upper(); }; + static domain_type lower(const interval_type& inter_val){ return inter_val.lower(); } + static domain_type upper(const interval_type& inter_val){ return inter_val.upper(); } }; diff --git a/contrib/restricted/boost/icl/include/boost/icl/discrete_interval.hpp b/contrib/restricted/boost/icl/include/boost/icl/discrete_interval.hpp index c7e7bbc1fa0..c52494dfd42 100644 --- a/contrib/restricted/boost/icl/include/boost/icl/discrete_interval.hpp +++ b/contrib/restricted/boost/icl/include/boost/icl/discrete_interval.hpp @@ -100,8 +100,8 @@ struct interval_traits< icl::discrete_interval<DomainT, Compare> > return interval_type(lo, up); } - static domain_type lower(const interval_type& inter_val){ return inter_val.lower(); }; - static domain_type upper(const interval_type& inter_val){ return inter_val.upper(); }; + static domain_type lower(const interval_type& inter_val){ return inter_val.lower(); } + static domain_type upper(const interval_type& inter_val){ return inter_val.upper(); } }; //============================================================================== diff --git a/contrib/restricted/boost/icl/include/boost/icl/interval_base_set.hpp b/contrib/restricted/boost/icl/include/boost/icl/interval_base_set.hpp index b6277e23ba9..d693bd432ec 100644 --- a/contrib/restricted/boost/icl/include/boost/icl/interval_base_set.hpp +++ b/contrib/restricted/boost/icl/include/boost/icl/interval_base_set.hpp @@ -20,7 +20,7 @@ Copyright (c) 1999-2006: Cortex Software GmbH, Kantstrasse 57, Berlin #endif #include <limits> -#include <boost/next_prior.hpp> +#include <boost/next_prior.hpp> #include <boost/icl/associative_interval_container.hpp> #include <boost/icl/type_traits/interval_type_default.hpp> #include <boost/icl/interval.hpp> @@ -40,14 +40,14 @@ namespace boost{namespace icl { /** \brief Implements a set as a set of intervals (base class) */ -template +template < typename SubType, - typename DomainT, + typename DomainT, ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(ICL_COMPARE_DEFAULT, DomainT), ICL_INTERVAL(ICL_COMPARE) Interval = ICL_INTERVAL_INSTANCE(ICL_INTERVAL_DEFAULT, DomainT, Compare), ICL_ALLOC Alloc = std::allocator -> +> class interval_base_set { public: @@ -115,7 +115,7 @@ public: /// allocator type of the corresponding element set typedef Alloc<DomainT> domain_allocator_type; - /// Container type for the implementation + /// Container type for the implementation typedef typename ICL_IMPL_SPACE::set<interval_type,key_compare,allocator_type> ImplSetT; /// key type of the implementing container @@ -144,15 +144,15 @@ public: typedef typename ImplSetT::const_reverse_iterator const_reverse_iterator; /// element iterator: Depreciated, see documentation. - typedef boost::icl::element_iterator<iterator> element_iterator; + typedef boost::icl::element_iterator<iterator> element_iterator; /// element const iterator: Depreciated, see documentation. - typedef boost::icl::element_iterator<const_iterator> element_const_iterator; + typedef boost::icl::element_iterator<const_iterator> element_const_iterator; /// element reverse iterator: Depreciated, see documentation. - typedef boost::icl::element_iterator<reverse_iterator> element_reverse_iterator; + typedef boost::icl::element_iterator<reverse_iterator> element_reverse_iterator; /// element const reverse iterator: Depreciated, see documentation. - typedef boost::icl::element_iterator<const_reverse_iterator> element_const_reverse_iterator; + typedef boost::icl::element_iterator<const_reverse_iterator> element_const_reverse_iterator; - BOOST_STATIC_CONSTANT(int, fineness = 0); + BOOST_STATIC_CONSTANT(int, fineness = 0); public: //========================================================================== @@ -181,20 +181,20 @@ public: } /** Move assignment operator */ - interval_base_set& operator = (interval_base_set src) + interval_base_set& operator = (interval_base_set src) { //call by value sice 'src' is a "sink value" this->_set = boost::move(src._set); - return *this; + return *this; } //========================================================================== # else /** Copy assignment operator */ - interval_base_set& operator = (const interval_base_set& src) - { + interval_base_set& operator = (const interval_base_set& src) + { this->_set = src._set; - return *this; + return *this; } # endif // BOOST_ICL_NO_CXX11_RVALUE_REFERENCES @@ -220,9 +220,9 @@ public: } /** Size of the iteration over this container */ - std::size_t iterative_size()const - { - return _set.size(); + std::size_t iterative_size()const + { + return _set.size(); } //========================================================================== @@ -231,15 +231,15 @@ public: /** Find the interval, that contains element \c key_value */ const_iterator find(const element_type& key_value)const - { + { return icl::find(*this, key_value); - //CL return this->_set.find(icl::singleton<segment_type>(key)); + //CL return this->_set.find(icl::singleton<segment_type>(key)); } /** Find the first interval, that collides with interval \c key_interval */ const_iterator find(const interval_type& key_interval)const - { - return this->_set.find(key_interval); + { + return this->_set.find(key_interval); } //========================================================================== @@ -247,23 +247,23 @@ public: //========================================================================== /** Add a single element \c key to the set */ - SubType& add(const element_type& key) + SubType& add(const element_type& key) { return icl::add(*that(), key); } /** Add an interval of elements \c inter_val to the set */ - SubType& add(const segment_type& inter_val) + SubType& add(const segment_type& inter_val) { _add(inter_val); return *that(); } - /** Add an interval of elements \c inter_val to the set. Iterator - \c prior_ is a hint to the position \c inter_val can be + /** Add an interval of elements \c inter_val to the set. Iterator + \c prior_ is a hint to the position \c inter_val can be inserted after. */ - iterator add(iterator prior_, const segment_type& inter_val) - { + iterator add(iterator prior_, const segment_type& inter_val) + { return _add(prior_, inter_val); } @@ -272,35 +272,35 @@ public: //========================================================================== /** Subtract a single element \c key from the set */ - SubType& subtract(const element_type& key) - { + SubType& subtract(const element_type& key) + { return icl::subtract(*that(), key); } /** Subtract an interval of elements \c inter_val from the set */ - SubType& subtract(const segment_type& inter_val); + SubType& subtract(const segment_type& inter_val); //========================================================================== //= Insertion //========================================================================== /** Insert an element \c key into the set */ - SubType& insert(const element_type& key) - { - return add(key); + SubType& insert(const element_type& key) + { + return add(key); } /** Insert an interval of elements \c inter_val to the set */ - SubType& insert(const segment_type& inter_val) - { - return add(inter_val); + SubType& insert(const segment_type& inter_val) + { + return add(inter_val); } - /** Insert an interval of elements \c inter_val to the set. Iterator - \c prior_ is a hint to the position \c inter_val can be + /** Insert an interval of elements \c inter_val to the set. Iterator + \c prior_ is a hint to the position \c inter_val can be inserted after. */ - iterator insert(iterator prior_, const segment_type& inter_val) - { - return add(prior_, inter_val); + iterator insert(iterator prior_, const segment_type& inter_val) + { + return add(prior_, inter_val); } @@ -309,27 +309,27 @@ public: //= Erasure //========================================================================== /** Erase an element \c key from the set */ - SubType& erase(const element_type& key) - { - return subtract(key); + SubType& erase(const element_type& key) + { + return subtract(key); } /** Erase an interval of elements \c inter_val from the set */ - SubType& erase(const segment_type& inter_val) - { - return subtract(inter_val); + SubType& erase(const segment_type& inter_val) + { + return subtract(inter_val); } /** Erase the interval that iterator \c position points to. */ void erase(iterator position) - { - _set.erase(position); + { + _set.erase(position); } /** Erase all intervals in the range <tt>[first,past)</tt> of iterators. */ void erase(iterator first, iterator past) - { - _set.erase(first, past); + { + _set.erase(first, past); } //========================================================================== @@ -373,16 +373,16 @@ public: { return _set.upper_bound(interval); } std::pair<iterator,iterator> equal_range(const key_type& interval) - { + { return std::pair<iterator,iterator> - (_set.lower_bound(interval), _set.upper_bound(interval)); + (_set.lower_bound(interval), _set.upper_bound(interval)); } - std::pair<const_iterator,const_iterator> + std::pair<const_iterator,const_iterator> equal_range(const key_type& interval)const - { + { return std::pair<const_iterator,const_iterator> - (_set.lower_bound(interval), _set.upper_bound(interval)); + (_set.lower_bound(interval), _set.upper_bound(interval)); } private: @@ -470,7 +470,7 @@ inline void interval_base_set<SubType,DomainT,Compare,Interval,Alloc> // [lead_gap--- . . . // [prior_) [-- it_ ... this->_set.insert(prior_, lead_gap); - + interval_type end_gap = left_subtract(inter_val, cur_itv); if(!icl::is_empty(end_gap)) // [---------------end_gap) @@ -495,12 +495,12 @@ inline void interval_base_set<SubType,DomainT,Compare,Interval,Alloc> //= Addition //============================================================================== template <class SubType, class DomainT, ICL_COMPARE Compare, ICL_INTERVAL(ICL_COMPARE) Interval, ICL_ALLOC Alloc> -inline typename interval_base_set<SubType,DomainT,Compare,Interval,Alloc>::iterator +inline typename interval_base_set<SubType,DomainT,Compare,Interval,Alloc>::iterator interval_base_set<SubType,DomainT,Compare,Interval,Alloc> ::_add(const segment_type& addend) { typedef typename interval_base_set<SubType,DomainT,Compare,Interval,Alloc>::iterator iterator; - if(icl::is_empty(addend)) + if(icl::is_empty(addend)) return this->_set.end(); std::pair<iterator,bool> insertion = this->_set.insert(addend); @@ -515,7 +515,7 @@ inline typename interval_base_set<SubType,DomainT,Compare,Interval,Alloc>::itera } template <class SubType, class DomainT, ICL_COMPARE Compare, ICL_INTERVAL(ICL_COMPARE) Interval, ICL_ALLOC Alloc> -inline typename interval_base_set<SubType,DomainT,Compare,Interval,Alloc>::iterator +inline typename interval_base_set<SubType,DomainT,Compare,Interval,Alloc>::iterator interval_base_set<SubType,DomainT,Compare,Interval,Alloc> ::_add(iterator prior_, const segment_type& addend) { @@ -541,11 +541,11 @@ template <class SubType, class DomainT, ICL_COMPARE Compare, ICL_INTERVAL(ICL_CO inline SubType& interval_base_set<SubType,DomainT,Compare,Interval,Alloc> ::subtract(const segment_type& minuend) { - if(icl::is_empty(minuend)) + if(icl::is_empty(minuend)) return *that(); std::pair<iterator, iterator> exterior = equal_range(minuend); - if(exterior.first == exterior.second) + if(exterior.first == exterior.second) return *that(); iterator first_ = exterior.first; @@ -553,7 +553,7 @@ inline SubType& interval_base_set<SubType,DomainT,Compare,Interval,Alloc> iterator last_ = prior(end_); interval_type left_resid = right_subtract(*first_, minuend); - interval_type right_resid; + interval_type right_resid; if(first_ != end_) right_resid = left_subtract(*last_ , minuend); @@ -574,17 +574,17 @@ inline SubType& interval_base_set<SubType,DomainT,Compare,Interval,Alloc> template<class SubType, class DomainT, ICL_COMPARE Compare, ICL_INTERVAL(ICL_COMPARE) Interval, ICL_ALLOC Alloc> struct is_set<icl::interval_base_set<SubType,DomainT,Compare,Interval,Alloc> > -{ +{ typedef is_set<icl::interval_base_set<SubType,DomainT,Compare,Interval,Alloc> > type; - BOOST_STATIC_CONSTANT(bool, value = true); + BOOST_STATIC_CONSTANT(bool, value = true); }; template<class SubType, class DomainT, ICL_COMPARE Compare, ICL_INTERVAL(ICL_COMPARE) Interval, ICL_ALLOC Alloc> struct is_interval_container<icl::interval_base_set<SubType,DomainT,Compare,Interval,Alloc> > -{ +{ typedef is_interval_container<icl::interval_base_set<SubType,DomainT,Compare,Interval,Alloc> > type; - BOOST_STATIC_CONSTANT(bool, value = true); + BOOST_STATIC_CONSTANT(bool, value = true); }; @@ -592,5 +592,3 @@ struct is_interval_container<icl::interval_base_set<SubType,DomainT,Compare,Inte }} // namespace icl boost #endif - - diff --git a/contrib/restricted/boost/icl/include/boost/icl/iterator.hpp b/contrib/restricted/boost/icl/include/boost/icl/iterator.hpp index 240e8f88e46..865aa2f9185 100644 --- a/contrib/restricted/boost/icl/include/boost/icl/iterator.hpp +++ b/contrib/restricted/boost/icl/include/boost/icl/iterator.hpp @@ -16,12 +16,15 @@ namespace boost{namespace icl /** \brief Performes an addition using a container's memberfunction add, when operator= is called. */ template<class ContainerT> class add_iterator - : public std::iterator<std::output_iterator_tag, void, void, void, void> { public: /// The container's type. typedef ContainerT container_type; typedef std::output_iterator_tag iterator_category; + typedef void value_type; + typedef void difference_type; + typedef void pointer; + typedef void reference; /** An add_iterator is constructed with a container and a position that has to be maintained. */ @@ -57,12 +60,15 @@ inline add_iterator<ContainerT> adder(ContainerT& cont, IteratorT iter_) /** \brief Performes an insertion using a container's memberfunction add, when operator= is called. */ template<class ContainerT> class insert_iterator - : public std::iterator<std::output_iterator_tag, void, void, void, void> { public: /// The container's type. typedef ContainerT container_type; typedef std::output_iterator_tag iterator_category; + typedef void value_type; + typedef void difference_type; + typedef void pointer; + typedef void reference; /** An insert_iterator is constructed with a container and a position that has to be maintained. */ diff --git a/contrib/restricted/boost/icl/include/boost/icl/left_open_interval.hpp b/contrib/restricted/boost/icl/include/boost/icl/left_open_interval.hpp index 817d3dcca05..3468997d302 100644 --- a/contrib/restricted/boost/icl/include/boost/icl/left_open_interval.hpp +++ b/contrib/restricted/boost/icl/include/boost/icl/left_open_interval.hpp @@ -9,15 +9,18 @@ Copyright (c) 2010-2010: Joachim Faulhaber #define BOOST_ICL_LEFT_OPEN_INTERVAL_HPP_JOFA_100930 #include <functional> +#include <boost/static_assert.hpp> #include <boost/concept/assert.hpp> +#include <boost/icl/detail/concept_check.hpp> #include <boost/icl/concept/interval.hpp> +#include <boost/icl/type_traits/succ_pred.hpp> #include <boost/icl/type_traits/value_size.hpp> #include <boost/icl/type_traits/type_to_string.hpp> namespace boost{namespace icl { -template <class DomainT, +template <class DomainT, ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(ICL_COMPARE_DEFAULT, DomainT)> class left_open_interval { @@ -31,8 +34,8 @@ public: //= Construct, copy, destruct //========================================================================== /** Default constructor; yields an empty interval <tt>(0,0]</tt>. */ - left_open_interval() - : _lwb(identity_element<DomainT>::value()), _upb(identity_element<DomainT>::value()) + left_open_interval() + : _lwb(identity_element<DomainT>::value()), _upb(identity_element<DomainT>::value()) { BOOST_CONCEPT_ASSERT((DefaultConstructibleConcept<DomainT>)); BOOST_CONCEPT_ASSERT((LessThanComparableConcept<DomainT>)); @@ -46,11 +49,11 @@ public: { BOOST_CONCEPT_ASSERT((DefaultConstructibleConcept<DomainT>)); BOOST_CONCEPT_ASSERT((LessThanComparableConcept<DomainT>)); - // Only for discrete types this ctor creates an interval containing + // Only for discrete types this ctor creates an interval containing // a single element only. BOOST_STATIC_ASSERT((icl::is_discrete<DomainT>::value)); BOOST_ASSERT((numeric_minimum<DomainT, domain_compare, is_numeric<DomainT>::value > - ::is_less_than(val) )); + ::is_less_than(val) )); } /** Interval from <tt>low</tt> to <tt>up</tt> with bounds <tt>bounds</tt> */ @@ -84,15 +87,15 @@ struct interval_traits< icl::left_open_interval<DomainT, Compare> > return interval_type(lo, up); } - static domain_type lower(const interval_type& inter_val){ return inter_val.lower(); }; - static domain_type upper(const interval_type& inter_val){ return inter_val.upper(); }; + static domain_type lower(const interval_type& inter_val){ return inter_val.lower(); } + static domain_type upper(const interval_type& inter_val){ return inter_val.upper(); } }; //============================================================================== //= Type traits //============================================================================== -template <class DomainT, ICL_COMPARE Compare> +template <class DomainT, ICL_COMPARE Compare> struct interval_bound_type< left_open_interval<DomainT,Compare> > { typedef interval_bound_type type; @@ -106,14 +109,13 @@ struct type_to_string<icl::left_open_interval<DomainT,Compare> > { return "(I]<"+ type_to_string<DomainT>::apply() +">"; } }; -template<class DomainT, ICL_COMPARE Compare> +template<class DomainT, ICL_COMPARE Compare> struct value_size<icl::left_open_interval<DomainT,Compare> > { - static std::size_t apply(const icl::left_open_interval<DomainT>&) + static std::size_t apply(const icl::left_open_interval<DomainT>&) { return 2; } }; }} // namespace icl boost #endif - diff --git a/contrib/restricted/boost/icl/include/boost/icl/open_interval.hpp b/contrib/restricted/boost/icl/include/boost/icl/open_interval.hpp index 95e464ce2c7..b94f2310207 100644 --- a/contrib/restricted/boost/icl/include/boost/icl/open_interval.hpp +++ b/contrib/restricted/boost/icl/include/boost/icl/open_interval.hpp @@ -9,16 +9,18 @@ Copyright (c) 2010-2010: Joachim Faulhaber #define BOOST_ICL_OPEN_INTERVAL_HPP_JOFA_100930 #include <functional> +#include <boost/static_assert.hpp> #include <boost/concept/assert.hpp> #include <boost/icl/detail/concept_check.hpp> #include <boost/icl/concept/interval.hpp> +#include <boost/icl/type_traits/succ_pred.hpp> #include <boost/icl/type_traits/value_size.hpp> #include <boost/icl/type_traits/type_to_string.hpp> namespace boost{namespace icl { -template <class DomainT, +template <class DomainT, ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(ICL_COMPARE_DEFAULT, DomainT)> class open_interval { @@ -32,8 +34,8 @@ public: //= Construct, copy, destruct //========================================================================== /** Default constructor; yields an empty interval <tt>(0,0)</tt>. */ - open_interval() - : _lwb(identity_element<DomainT>::value()), _upb(identity_element<DomainT>::value()) + open_interval() + : _lwb(identity_element<DomainT>::value()), _upb(identity_element<DomainT>::value()) { BOOST_CONCEPT_ASSERT((DefaultConstructibleConcept<DomainT>)); BOOST_CONCEPT_ASSERT((LessThanComparableConcept<DomainT>)); @@ -47,11 +49,11 @@ public: { BOOST_CONCEPT_ASSERT((DefaultConstructibleConcept<DomainT>)); BOOST_CONCEPT_ASSERT((LessThanComparableConcept<DomainT>)); - // Only for discrete types this ctor creates an interval containing + // Only for discrete types this ctor creates an interval containing // a single element only. BOOST_STATIC_ASSERT((icl::is_discrete<DomainT>::value)); BOOST_ASSERT((numeric_minimum<DomainT, domain_compare, is_numeric<DomainT>::value > - ::is_less_than(val) )); + ::is_less_than(val) )); } /** Interval from <tt>low</tt> to <tt>up</tt> with bounds <tt>bounds</tt> */ @@ -85,15 +87,15 @@ struct interval_traits< icl::open_interval<DomainT, Compare> > return interval_type(lo, up); } - static domain_type lower(const interval_type& inter_val){ return inter_val.lower(); }; - static domain_type upper(const interval_type& inter_val){ return inter_val.upper(); }; + static domain_type lower(const interval_type& inter_val){ return inter_val.lower(); } + static domain_type upper(const interval_type& inter_val){ return inter_val.upper(); } }; //============================================================================== //= Type traits //============================================================================== -template <class DomainT, ICL_COMPARE Compare> +template <class DomainT, ICL_COMPARE Compare> struct interval_bound_type< open_interval<DomainT,Compare> > { typedef interval_bound_type type; @@ -107,14 +109,13 @@ struct type_to_string<icl::open_interval<DomainT,Compare> > { return "(I)<"+ type_to_string<DomainT>::apply() +">"; } }; -template<class DomainT, ICL_COMPARE Compare> +template<class DomainT, ICL_COMPARE Compare> struct value_size<icl::open_interval<DomainT,Compare> > { - static std::size_t apply(const icl::open_interval<DomainT>&) + static std::size_t apply(const icl::open_interval<DomainT>&) { return 2; } }; }} // namespace icl boost #endif - diff --git a/contrib/restricted/boost/icl/include/boost/icl/right_open_interval.hpp b/contrib/restricted/boost/icl/include/boost/icl/right_open_interval.hpp index 96cde2cc1fe..a1027ce65cf 100644 --- a/contrib/restricted/boost/icl/include/boost/icl/right_open_interval.hpp +++ b/contrib/restricted/boost/icl/include/boost/icl/right_open_interval.hpp @@ -9,7 +9,9 @@ Copyright (c) 2010-2010: Joachim Faulhaber #define BOOST_ICL_RIGHT_OPEN_INTERVAL_HPP_JOFA_100323 #include <functional> +#include <boost/static_assert.hpp> #include <boost/concept/assert.hpp> +#include <boost/icl/detail/concept_check.hpp> #include <boost/icl/concept/interval.hpp> #include <boost/icl/type_traits/succ_pred.hpp> #include <boost/icl/type_traits/value_size.hpp> @@ -18,7 +20,7 @@ Copyright (c) 2010-2010: Joachim Faulhaber namespace boost{namespace icl { -template <class DomainT, +template <class DomainT, ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(ICL_COMPARE_DEFAULT, DomainT)> class right_open_interval { @@ -32,8 +34,8 @@ public: //= Construct, copy, destruct //========================================================================== /** Default constructor; yields an empty interval <tt>[0,0)</tt>. */ - right_open_interval() - : _lwb(identity_element<DomainT>::value()), _upb(identity_element<DomainT>::value()) + right_open_interval() + : _lwb(identity_element<DomainT>::value()), _upb(identity_element<DomainT>::value()) { BOOST_CONCEPT_ASSERT((DefaultConstructibleConcept<DomainT>)); BOOST_CONCEPT_ASSERT((LessThanComparableConcept<DomainT>)); @@ -47,7 +49,7 @@ public: { BOOST_CONCEPT_ASSERT((DefaultConstructibleConcept<DomainT>)); BOOST_CONCEPT_ASSERT((LessThanComparableConcept<DomainT>)); - // Only for discrete types this ctor creates an interval containing + // Only for discrete types this ctor creates an interval containing // a single element only. BOOST_STATIC_ASSERT((icl::is_discrete<DomainT>::value)); } @@ -83,15 +85,15 @@ struct interval_traits< icl::right_open_interval<DomainT, Compare> > return interval_type(lo, up); } - static domain_type lower(const interval_type& inter_val){ return inter_val.lower(); }; - static domain_type upper(const interval_type& inter_val){ return inter_val.upper(); }; + static domain_type lower(const interval_type& inter_val){ return inter_val.lower(); } + static domain_type upper(const interval_type& inter_val){ return inter_val.upper(); } }; //============================================================================== //= Type traits //============================================================================== -template <class DomainT, ICL_COMPARE Compare> +template <class DomainT, ICL_COMPARE Compare> struct interval_bound_type< right_open_interval<DomainT,Compare> > { typedef interval_bound_type type; @@ -105,14 +107,13 @@ struct type_to_string<icl::right_open_interval<DomainT,Compare> > { return "[I)<"+ type_to_string<DomainT>::apply() +">"; } }; -template<class DomainT, ICL_COMPARE Compare> +template<class DomainT, ICL_COMPARE Compare> struct value_size<icl::right_open_interval<DomainT,Compare> > { - static std::size_t apply(const icl::right_open_interval<DomainT>&) + static std::size_t apply(const icl::right_open_interval<DomainT>&) { return 2; } }; }} // namespace icl boost #endif - diff --git a/contrib/restricted/boost/icl/include/boost/icl/type_traits/rep_type_of.hpp b/contrib/restricted/boost/icl/include/boost/icl/type_traits/rep_type_of.hpp index 4cdc6cc4cba..27318a998e5 100644 --- a/contrib/restricted/boost/icl/include/boost/icl/type_traits/rep_type_of.hpp +++ b/contrib/restricted/boost/icl/include/boost/icl/type_traits/rep_type_of.hpp @@ -13,6 +13,7 @@ Copyright (c) 2008-2009: Joachim Faulhaber #include <boost/mpl/or.hpp> #include <boost/mpl/and.hpp> #include <boost/mpl/not.hpp> +#include <boost/type_traits/is_same.hpp> #include <boost/icl/type_traits/no_type.hpp> namespace boost{ namespace icl @@ -24,7 +25,7 @@ namespace boost{ namespace icl //-------------------------------------------------------------------------- template <class Type> - struct has_rep_type + struct has_rep_type : mpl::bool_<detail::has_rep<Type>::value> {}; @@ -33,14 +34,14 @@ namespace boost{ namespace icl : mpl::bool_<detail::has_rep<Type>::value> { typedef represents type; - BOOST_STATIC_CONSTANT(bool, + BOOST_STATIC_CONSTANT(bool, value = (mpl::and_< has_rep_type<Type> - , is_same<typename Type::rep, Rep> >::value) + , boost::is_same<typename Type::rep, Rep> >::value) ); }; //-------------------------------------------------------------------------- - template <class Type, bool has_rep> + template <class Type, bool has_rep> struct get_rep_type; template <class Type> @@ -56,15 +57,13 @@ namespace boost{ namespace icl }; //-------------------------------------------------------------------------- - template<class Type> + template<class Type> struct rep_type_of - { - typedef typename + { + typedef typename get_rep_type<Type, has_rep_type<Type>::value>::type type; }; }} // namespace boost icl #endif - - diff --git a/contrib/restricted/boost/icl/include/boost/icl/type_traits/value_size.hpp b/contrib/restricted/boost/icl/include/boost/icl/type_traits/value_size.hpp index 4a37f112615..94ba80a40d2 100644 --- a/contrib/restricted/boost/icl/include/boost/icl/type_traits/value_size.hpp +++ b/contrib/restricted/boost/icl/include/boost/icl/type_traits/value_size.hpp @@ -11,7 +11,7 @@ Copyright (c) 1999-2006: Cortex Software GmbH, Kantstrasse 57, Berlin #define BOOST_ICL_VALUE_SIZE_HPP_JOFA_081004 namespace boost{ namespace icl -{ +{ template <typename Type> Type abs(Type val) { return val < 0 ? -val : val; } @@ -33,13 +33,13 @@ struct value_size }; -template<> inline std::size_t value_size<int>::apply(const int& value) +template<> inline std::size_t value_size<int>::apply(const int& value) { return abs(value); } -template<> inline std::size_t value_size<double>::apply(const double& value) +template<> inline std::size_t value_size<double>::apply(const double& value) { return static_cast<int>(abs(value)); } -template <typename Type> +template <typename Type> inline std::size_t value_size<Type>::apply(const Type& value) { return icl::iterative_size(value); } @@ -48,5 +48,3 @@ inline std::size_t value_size<Type>::apply(const Type& value) }} // namespace boost icl #endif - - |