Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r71365 - in branches/release/boost/icl: . concept detail type_traits
From: afojgo_at_[hidden]
Date: 2011-04-17 17:49:05


Author: jofaber
Date: 2011-04-17 17:49:02 EDT (Sun, 17 Apr 2011)
New Revision: 71365
URL: http://svn.boost.org/trac/boost/changeset/71365

Log:
Merged changes [71328-71362] Bug fix for ticket #5482. Made library default for compare-ordering customizable.
Added:
   branches/release/boost/icl/type_traits/is_increasing.hpp
      - copied unchanged from r71331, /trunk/boost/icl/type_traits/is_increasing.hpp
Properties modified:
   branches/release/boost/icl/ (props changed)
Text files modified:
   branches/release/boost/icl/closed_interval.hpp | 2
   branches/release/boost/icl/concept/interval.hpp | 103 ++++++++++++++++++++++++++-------------
   branches/release/boost/icl/continuous_interval.hpp | 2
   branches/release/boost/icl/detail/design_config.hpp | 10 +++
   branches/release/boost/icl/detail/std_set.hpp | 7 ++
   branches/release/boost/icl/discrete_interval.hpp | 6 +-
   branches/release/boost/icl/interval.hpp | 2
   branches/release/boost/icl/interval_base_map.hpp | 2
   branches/release/boost/icl/interval_base_set.hpp | 2
   branches/release/boost/icl/interval_map.hpp | 2
   branches/release/boost/icl/interval_set.hpp | 2
   branches/release/boost/icl/left_open_interval.hpp | 5 +
   branches/release/boost/icl/map.hpp | 2
   branches/release/boost/icl/open_interval.hpp | 2
   branches/release/boost/icl/right_open_interval.hpp | 5 +
   branches/release/boost/icl/separate_interval_set.hpp | 2
   branches/release/boost/icl/split_interval_map.hpp | 2
   branches/release/boost/icl/split_interval_set.hpp | 2
   branches/release/boost/icl/type_traits/interval_type_default.hpp | 2
   branches/release/boost/icl/type_traits/succ_pred.hpp | 70 +++++++++++++++++++++++++-
   20 files changed, 169 insertions(+), 63 deletions(-)

Modified: branches/release/boost/icl/closed_interval.hpp
==============================================================================
--- branches/release/boost/icl/closed_interval.hpp (original)
+++ branches/release/boost/icl/closed_interval.hpp 2011-04-17 17:49:02 EDT (Sun, 17 Apr 2011)
@@ -16,7 +16,7 @@
 {
 
 template <class DomainT,
- ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(std::less, DomainT)>
+ ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(ICL_COMPARE_DEFAULT, DomainT)>
 class closed_interval
 {
 public:

Modified: branches/release/boost/icl/concept/interval.hpp
==============================================================================
--- branches/release/boost/icl/concept/interval.hpp (original)
+++ branches/release/boost/icl/concept/interval.hpp 2011-04-17 17:49:02 EDT (Sun, 17 Apr 2011)
@@ -61,6 +61,26 @@
     return !(domain_compare()(left, right)) && !(domain_compare()(right, 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)
+{
+ typedef typename interval_traits<Type>::domain_type domain_type;
+ typedef typename interval_traits<Type>::domain_compare domain_compare;
+ return icl::successor<domain_type,domain_compare>::apply(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)
+{
+ typedef typename interval_traits<Type>::domain_type domain_type;
+ typedef typename interval_traits<Type>::domain_compare domain_compare;
+ return icl::predecessor<domain_type,domain_compare>::apply(value);
+}
+
 //==============================================================================
 //= Construct<Interval> singleton
 //==============================================================================
@@ -74,7 +94,7 @@
 singleton(const typename interval_traits<Type>::domain_type& value)
 {
     //ASSERT: This always creates an interval with exactly one element
- return interval_traits<Type>::construct(value, icl::succ(value));
+ return interval_traits<Type>::construct(value, domain_next<Type>(value));
 }
 
 template<class Type>
@@ -90,7 +110,7 @@
     typedef typename interval_traits<Type>::domain_type domain_type;
     BOOST_ASSERT((numeric_minimum<domain_type, is_numeric<domain_type>::value >::is_less_than(value) ));
 
- return interval_traits<Type>::construct(icl::pred(value), value);
+ return interval_traits<Type>::construct(domain_prior<Type>(value), value);
 }
 
 template<class Type>
@@ -101,7 +121,8 @@
     typedef typename interval_traits<Type>::domain_type domain_type;
     BOOST_ASSERT((numeric_minimum<domain_type, is_numeric<domain_type>::value >::is_less_than(value)));
 
- return interval_traits<Type>::construct(icl::pred(value), icl::succ(value));
+ return interval_traits<Type>::construct( domain_prior<Type>(value)
+ , domain_next<Type>(value));
 }
 
 template<class Type>
@@ -139,7 +160,7 @@
>::type
 unit_trail(const typename interval_traits<Type>::domain_type& value)
 {
- return interval_traits<Type>::construct(value, icl::succ(value));
+ return interval_traits<Type>::construct(value, domain_next<Type>(value));
 }
 
 template<class Type>
@@ -154,7 +175,7 @@
     typedef typename interval_traits<Type>::domain_type domain_type;
     BOOST_ASSERT((numeric_minimum<domain_type, is_numeric<domain_type>::value >::is_less_than(value) ));
 
- return interval_traits<Type>::construct(icl::pred(value), value);
+ return interval_traits<Type>::construct(domain_prior<Type>(value), value);
 }
 
 template<class Type>
@@ -169,7 +190,8 @@
     typedef typename interval_traits<Type>::domain_type domain_type;
     BOOST_ASSERT((numeric_minimum<domain_type, is_numeric<domain_type>::value >::is_less_than(value)));
 
- return interval_traits<Type>::construct(icl::pred(value), icl::succ(value));
+ return interval_traits<Type>::construct( domain_prior<Type>(value)
+ , domain_next<Type>(value));
 }
 
 template<class Type>
@@ -233,7 +255,7 @@
 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))
+ if(interval_traits<Type>::domain_compare()(left,right))
         return construct<Type>(left, right);
     else
         return construct<Type>(right, left);
@@ -246,10 +268,10 @@
 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))
- return construct<Type>(left, icl::succ(right));
+ if(interval_traits<Type>::domain_compare()(left,right))
+ return construct<Type>(left, domain_next<Type>(right));
     else
- return construct<Type>(right, icl::succ(left));
+ return construct<Type>(right, domain_next<Type>(left));
 }
 
 template<class Type>
@@ -258,15 +280,15 @@
      const typename interval_traits<Type>::domain_type& right)
 {
     typedef typename interval_traits<Type>::domain_type domain_type;
- if(interval_traits<Type>::domain_compare(left,right))
+ if(interval_traits<Type>::domain_compare()(left,right))
     {
         BOOST_ASSERT((numeric_minimum<domain_type, is_numeric<domain_type>::value >::is_less_than(left) ));
- return construct<Type>(icl::pred(left), right);
+ return construct<Type>(domain_prior<Type>(left), right);
     }
     else
     {
         BOOST_ASSERT((numeric_minimum<domain_type, is_numeric<domain_type>::value >::is_less_than(right) ));
- return construct<Type>(icl::pred(right), left);
+ return construct<Type>(domain_prior<Type>(right), left);
     }
 }
 
@@ -275,7 +297,7 @@
 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))
+ if(interval_traits<Type>::domain_compare()(left,right))
         return construct<Type>(left, right);
     else
         return construct<Type>(right, left);
@@ -287,15 +309,17 @@
      const typename interval_traits<Type>::domain_type& right)
 {
     typedef typename interval_traits<Type>::domain_type domain_type;
- if(interval_traits<Type>::domain_compare(left,right))
+ if(interval_traits<Type>::domain_compare()(left,right))
     {
         BOOST_ASSERT((numeric_minimum<domain_type, is_numeric<domain_type>::value >::is_less_than(left) ));
- return construct<Type>(icl::pred(left), icl::succ(right));
+ return construct<Type>( domain_prior<Type>(left)
+ , domain_next<Type>(right));
     }
     else
     {
         BOOST_ASSERT((numeric_minimum<domain_type, is_numeric<domain_type>::value >::is_less_than(right) ));
- return construct<Type>(icl::pred(right), icl::succ(left));
+ return construct<Type>( domain_prior<Type>(right)
+ , domain_next<Type>(left));
     }
 }
 
@@ -304,7 +328,7 @@
 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))
+ if(interval_traits<Type>::domain_compare()(left,right))
         return construct<Type>(left, right, interval_bounds::closed());
     else
         return construct<Type>(right, left, interval_bounds::closed());
@@ -348,7 +372,7 @@
          , typename interval_traits<Type>::domain_type>::type
 first(const Type& object)
 {
- return icl::succ(lower(object));
+ return domain_next<Type>(lower(object));
 }
 
 template<class Type>
@@ -357,8 +381,8 @@
 first(const Type& object)
 {
     return is_left_closed(object.bounds()) ?
- lower(object) :
- icl::succ(lower(object));
+ lower(object) :
+ domain_next<Type>(lower(object));
 }
 
 //- last -----------------------------------------------------------------------
@@ -381,7 +405,7 @@
     typedef typename interval_traits<Type>::domain_type domain_type;
     BOOST_ASSERT((numeric_minimum<domain_type, is_numeric<domain_type>::value>
                                  ::is_less_than(upper(object)) ));
- return icl::pred(upper(object));
+ return domain_prior<Type>(upper(object));
 }
 
 template<class Type>
@@ -393,8 +417,8 @@
     BOOST_ASSERT((numeric_minimum<domain_type, is_numeric<domain_type>::value>
                                  ::is_less_than_or(upper(object), is_right_closed(object.bounds())) ));
     return is_right_closed(object.bounds()) ?
- upper(object) :
- icl::pred(upper(object));
+ upper(object) :
+ domain_prior<Type>(upper(object));
 }
 
 //- last_next ------------------------------------------------------------------
@@ -405,7 +429,7 @@
          , typename interval_traits<Type>::domain_type>::type
 last_next(const Type& object)
 {
- return icl::succ(upper(object));
+ return domain_next<Type>(upper(object));
 }
 
 template<class Type>
@@ -425,8 +449,8 @@
 last_next(const Type& object)
 {
     return is_right_closed(object.bounds()) ?
- icl::succ(upper(object)):
- upper(object) ;
+ domain_next<Type>(upper(object)):
+ upper(object) ;
 }
 
 //------------------------------------------------------------------------------
@@ -507,7 +531,7 @@
 typename boost::enable_if<is_static_open<Type>, bool>::type
 is_empty(const Type& object)
 {
- return domain_less_equal<Type>(upper(object), icl::succ(lower(object)));
+ return domain_less_equal<Type>(upper(object), domain_next<Type>(lower(object)));
 }
 
 template<class Type>
@@ -517,7 +541,7 @@
     if(object.bounds() == interval_bounds::closed())
         return domain_less<Type>(upper(object), lower(object));
     else if(object.bounds() == interval_bounds::open())
- return domain_less_equal<Type>(upper(object), icl::succ(lower(object)));
+ return domain_less_equal<Type>(upper(object), domain_next<Type>(lower(object)));
     else
         return domain_less_equal<Type>(upper(object), lower(object));
 }
@@ -873,6 +897,13 @@
             || (lower_equal(left,right) && upper_less(left,right));
 }
 
+template<class Type>
+inline typename boost::enable_if<is_interval<Type>, bool>::type
+operator > (const Type& left, const Type& right)
+{
+ return right < left;
+}
+
 
 
 //------------------------------------------------------------------------------
@@ -894,7 +925,7 @@
 typename boost::enable_if<is_discrete_interval<Type>, bool>::type
 touches(const Type& left, const Type& right)
 {
- return domain_equal<Type>(icl::succ(last(left)), first(right));
+ return domain_equal<Type>(domain_next<Type>(last(left)), first(right));
 }
 
 template<class Type>
@@ -1100,7 +1131,7 @@
     if(exclusive_less(left_minuend, right))
         return right;
 
- return construct<Type>(icl::succ(upper(left_minuend)), upper(right));
+ return construct<Type>(domain_next<Type>(upper(left_minuend)), upper(right));
 }
 
 template<class Type>
@@ -1110,7 +1141,7 @@
     if(exclusive_less(left_minuend, right))
         return right;
 
- return construct<Type>(icl::pred(upper(left_minuend)), upper(right));
+ return construct<Type>(domain_prior<Type>(upper(left_minuend)), upper(right));
 }
 
 template<class Type>
@@ -1152,7 +1183,7 @@
     else if(lower_less_equal(right_minuend, left))
         return identity_element<Type>::value();
 
- return construct<Type>(lower(left), icl::pred(lower(right_minuend)));
+ return construct<Type>(lower(left), domain_prior<Type>(lower(right_minuend)));
 }
 
 template<class Type>
@@ -1162,7 +1193,7 @@
     if(exclusive_less(left, right_minuend))
         return left;
 
- return construct<Type>(lower(left), icl::succ(lower(right_minuend)));
+ return construct<Type>(lower(left), domain_next<Type>(lower(right_minuend)));
 }
 
 template<class Type>
@@ -1273,9 +1304,9 @@
     if(icl::is_empty(left) || icl::is_empty(right))
         return identity_element<Type>::value();
     else if(exclusive_less(left, right))
- return construct<Type>(icl::succ(upper(left)), icl::pred(lower(right)));
+ return construct<Type>(domain_next<Type>(upper(left)), domain_prior<Type>(lower(right)));
     else if(exclusive_less(right, left))
- return construct<Type>(icl::succ(upper(right)), icl::pred(lower(left)));
+ return construct<Type>(domain_next<Type>(upper(right)), domain_prior<Type>(lower(left)));
     else
         return identity_element<Type>::value();
 }

Modified: branches/release/boost/icl/continuous_interval.hpp
==============================================================================
--- branches/release/boost/icl/continuous_interval.hpp (original)
+++ branches/release/boost/icl/continuous_interval.hpp 2011-04-17 17:49:02 EDT (Sun, 17 Apr 2011)
@@ -24,7 +24,7 @@
 {
 
 template <class DomainT,
- ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(std::less, DomainT)>
+ ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(ICL_COMPARE_DEFAULT, DomainT)>
 class continuous_interval
 {
 public:

Modified: branches/release/boost/icl/detail/design_config.hpp
==============================================================================
--- branches/release/boost/icl/detail/design_config.hpp (original)
+++ branches/release/boost/icl/detail/design_config.hpp 2011-04-17 17:49:02 EDT (Sun, 17 Apr 2011)
@@ -95,10 +95,16 @@
 
 
 //------------------------------------------------------------------------------
-#define ICL_INTERVAL_DEFAULT boost::icl::interval_type_default
+#define ICL_ALLOC template<class>class
 
 //------------------------------------------------------------------------------
-#define ICL_ALLOC template<class>class
+#define ICL_INTERVAL_DEFAULT boost::icl::interval_type_default
+
+#ifndef BOOST_ICL_USE_COMPARE_STD_GREATER
+# define ICL_COMPARE_DEFAULT std::less
+#else
+# define ICL_COMPARE_DEFAULT std::greater
+#endif
 
 //------------------------------------------------------------------------------
 

Modified: branches/release/boost/icl/detail/std_set.hpp
==============================================================================
--- branches/release/boost/icl/detail/std_set.hpp (original)
+++ branches/release/boost/icl/detail/std_set.hpp 2011-04-17 17:49:02 EDT (Sun, 17 Apr 2011)
@@ -32,6 +32,13 @@
     { return "set<"+ type_to_string<Type>::apply() +">"; }
 };
 
+template <class Type>
+struct type_to_string<std::set<Type, std::greater<Type> > >
+{
+ static std::string apply()
+ { return "set<"+ type_to_string<Type>::apply() +" g>"; }
+};
+
 }} // namespace icl boost
 
 #endif // BOOST_ICL_DETAIL_STD_SET_HPP_JOFA_101007

Modified: branches/release/boost/icl/discrete_interval.hpp
==============================================================================
--- branches/release/boost/icl/discrete_interval.hpp (original)
+++ branches/release/boost/icl/discrete_interval.hpp 2011-04-17 17:49:02 EDT (Sun, 17 Apr 2011)
@@ -24,7 +24,7 @@
 {
 
 template <class DomainT,
- ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(std::less, DomainT)>
+ ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(ICL_COMPARE_DEFAULT, DomainT)>
 class discrete_interval
 {
 public:
@@ -72,10 +72,10 @@
     domain_type upper()const { return _upb; }
     interval_bounds bounds()const{ return _bounds; }
 
- static discrete_interval open (const DomainT& lo, const DomainT& up){ return discrete_interval(lo, up, interval_bounds::open()); }
+ static discrete_interval open (const DomainT& lo, const DomainT& up){ return discrete_interval(lo, up, interval_bounds::open()); }
     static discrete_interval right_open(const DomainT& lo, const DomainT& up){ return discrete_interval(lo, up, interval_bounds::right_open());}
     static discrete_interval left_open (const DomainT& lo, const DomainT& up){ return discrete_interval(lo, up, interval_bounds::left_open()); }
- static discrete_interval closed (const DomainT& lo, const DomainT& up){ return discrete_interval(lo, up, interval_bounds::closed()); }
+ static discrete_interval closed (const DomainT& lo, const DomainT& up){ return discrete_interval(lo, up, interval_bounds::closed()); }
 
 private:
     domain_type _lwb;

Modified: branches/release/boost/icl/interval.hpp
==============================================================================
--- branches/release/boost/icl/interval.hpp (original)
+++ branches/release/boost/icl/interval.hpp 2011-04-17 17:49:02 EDT (Sun, 17 Apr 2011)
@@ -18,7 +18,7 @@
     template <class IntervalT, bool IsDiscrete, bound_type PretendedBounds, bound_type RepresentedBounds>
     struct static_interval;
 
- template <class DomainT, ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(std::less, DomainT)>
+ template <class DomainT, ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(ICL_COMPARE_DEFAULT, DomainT)>
     struct interval
     {
         typedef typename interval_type_default<DomainT,Compare>::type interval_type;

Modified: branches/release/boost/icl/interval_base_map.hpp
==============================================================================
--- branches/release/boost/icl/interval_base_map.hpp (original)
+++ branches/release/boost/icl/interval_base_map.hpp 2011-04-17 17:49:02 EDT (Sun, 17 Apr 2011)
@@ -50,7 +50,7 @@
     typename DomainT,
     typename CodomainT,
     class Traits = icl::partial_absorber,
- ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(std::less, DomainT),
+ ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(ICL_COMPARE_DEFAULT, DomainT),
     ICL_COMBINE Combine = ICL_COMBINE_INSTANCE(icl::inplace_plus, CodomainT),
     ICL_SECTION Section = ICL_SECTION_INSTANCE(icl::inter_section, CodomainT),
     ICL_INTERVAL(ICL_COMPARE) Interval = ICL_INTERVAL_INSTANCE(ICL_INTERVAL_DEFAULT, DomainT, Compare),

Modified: branches/release/boost/icl/interval_base_set.hpp
==============================================================================
--- branches/release/boost/icl/interval_base_set.hpp (original)
+++ branches/release/boost/icl/interval_base_set.hpp 2011-04-17 17:49:02 EDT (Sun, 17 Apr 2011)
@@ -44,7 +44,7 @@
 <
     typename SubType,
     typename DomainT,
- ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(std::less, 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
>

Modified: branches/release/boost/icl/interval_map.hpp
==============================================================================
--- branches/release/boost/icl/interval_map.hpp (original)
+++ branches/release/boost/icl/interval_map.hpp 2011-04-17 17:49:02 EDT (Sun, 17 Apr 2011)
@@ -28,7 +28,7 @@
     typename DomainT,
     typename CodomainT,
     class Traits = icl::partial_absorber,
- ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(std::less, DomainT),
+ ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(ICL_COMPARE_DEFAULT, DomainT),
     ICL_COMBINE Combine = ICL_COMBINE_INSTANCE(icl::inplace_plus, CodomainT),
     ICL_SECTION Section = ICL_SECTION_INSTANCE(icl::inter_section, CodomainT),
     ICL_INTERVAL(ICL_COMPARE) Interval = ICL_INTERVAL_INSTANCE(ICL_INTERVAL_DEFAULT, DomainT, Compare),

Modified: branches/release/boost/icl/interval_set.hpp
==============================================================================
--- branches/release/boost/icl/interval_set.hpp (original)
+++ branches/release/boost/icl/interval_set.hpp 2011-04-17 17:49:02 EDT (Sun, 17 Apr 2011)
@@ -20,7 +20,7 @@
 template
 <
     typename DomainT,
- ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(std::less, 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
>

Modified: branches/release/boost/icl/left_open_interval.hpp
==============================================================================
--- branches/release/boost/icl/left_open_interval.hpp (original)
+++ branches/release/boost/icl/left_open_interval.hpp 2011-04-17 17:49:02 EDT (Sun, 17 Apr 2011)
@@ -18,12 +18,13 @@
 {
 
 template <class DomainT,
- ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(std::less, DomainT)>
+ ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(ICL_COMPARE_DEFAULT, DomainT)>
 class left_open_interval
 {
 public:
     typedef left_open_interval<DomainT,Compare> type;
     typedef DomainT domain_type;
+ typedef ICL_COMPARE_DOMAIN(Compare,DomainT) domain_compare;
 
 public:
     //==========================================================================
@@ -41,7 +42,7 @@
 
     /** Constructor for a left-open singleton interval <tt>(val-1,val]</tt> */
     explicit left_open_interval(const DomainT& val)
- : _lwb(icl::pred(val)), _upb(val)
+ : _lwb(predecessor<DomainT,domain_compare>::apply(val)), _upb(val)
     {
         BOOST_CONCEPT_ASSERT((DefaultConstructibleConcept<DomainT>));
         BOOST_CONCEPT_ASSERT((LessThanComparableConcept<DomainT>));

Modified: branches/release/boost/icl/map.hpp
==============================================================================
--- branches/release/boost/icl/map.hpp (original)
+++ branches/release/boost/icl/map.hpp 2011-04-17 17:49:02 EDT (Sun, 17 Apr 2011)
@@ -87,7 +87,7 @@
     typename DomainT,
     typename CodomainT,
     class Traits = icl::partial_absorber,
- ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(std::less, DomainT),
+ ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(ICL_COMPARE_DEFAULT, DomainT),
     ICL_COMBINE Combine = ICL_COMBINE_INSTANCE(icl::inplace_plus, CodomainT),
     ICL_SECTION Section = ICL_SECTION_INSTANCE(icl::inter_section, CodomainT),
     ICL_ALLOC Alloc = std::allocator

Modified: branches/release/boost/icl/open_interval.hpp
==============================================================================
--- branches/release/boost/icl/open_interval.hpp (original)
+++ branches/release/boost/icl/open_interval.hpp 2011-04-17 17:49:02 EDT (Sun, 17 Apr 2011)
@@ -18,7 +18,7 @@
 {
 
 template <class DomainT,
- ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(std::less, DomainT)>
+ ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(ICL_COMPARE_DEFAULT, DomainT)>
 class open_interval
 {
 public:

Modified: branches/release/boost/icl/right_open_interval.hpp
==============================================================================
--- branches/release/boost/icl/right_open_interval.hpp (original)
+++ branches/release/boost/icl/right_open_interval.hpp 2011-04-17 17:49:02 EDT (Sun, 17 Apr 2011)
@@ -19,12 +19,13 @@
 {
 
 template <class DomainT,
- ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(std::less, DomainT)>
+ ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(ICL_COMPARE_DEFAULT, DomainT)>
 class right_open_interval
 {
 public:
     typedef right_open_interval<DomainT,Compare> type;
     typedef DomainT domain_type;
+ typedef ICL_COMPARE_DOMAIN(Compare,DomainT) domain_compare;
 
 public:
     //==========================================================================
@@ -42,7 +43,7 @@
 
     /** Constructor for a singleton interval <tt>[val,val+1)</tt> */
     explicit right_open_interval(const DomainT& val)
- : _lwb(val), _upb(icl::succ(val))
+ : _lwb(val), _upb(icl::successor<DomainT,domain_compare>::apply(val))
     {
         BOOST_CONCEPT_ASSERT((DefaultConstructibleConcept<DomainT>));
         BOOST_CONCEPT_ASSERT((LessThanComparableConcept<DomainT>));

Modified: branches/release/boost/icl/separate_interval_set.hpp
==============================================================================
--- branches/release/boost/icl/separate_interval_set.hpp (original)
+++ branches/release/boost/icl/separate_interval_set.hpp 2011-04-17 17:49:02 EDT (Sun, 17 Apr 2011)
@@ -20,7 +20,7 @@
 template
 <
     typename DomainT,
- ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(std::less, 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
>

Modified: branches/release/boost/icl/split_interval_map.hpp
==============================================================================
--- branches/release/boost/icl/split_interval_map.hpp (original)
+++ branches/release/boost/icl/split_interval_map.hpp 2011-04-17 17:49:02 EDT (Sun, 17 Apr 2011)
@@ -24,7 +24,7 @@
     typename DomainT,
     typename CodomainT,
     class Traits = icl::partial_absorber,
- ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(std::less, DomainT),
+ ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(ICL_COMPARE_DEFAULT, DomainT),
     ICL_COMBINE Combine = ICL_COMBINE_INSTANCE(icl::inplace_plus, CodomainT),
     ICL_SECTION Section = ICL_SECTION_INSTANCE(icl::inter_section, CodomainT),
     ICL_INTERVAL(ICL_COMPARE) Interval = ICL_INTERVAL_INSTANCE(ICL_INTERVAL_DEFAULT, DomainT, Compare),

Modified: branches/release/boost/icl/split_interval_set.hpp
==============================================================================
--- branches/release/boost/icl/split_interval_set.hpp (original)
+++ branches/release/boost/icl/split_interval_set.hpp 2011-04-17 17:49:02 EDT (Sun, 17 Apr 2011)
@@ -21,7 +21,7 @@
 template
 <
     typename DomainT,
- ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(std::less, 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
>

Modified: branches/release/boost/icl/type_traits/interval_type_default.hpp
==============================================================================
--- branches/release/boost/icl/type_traits/interval_type_default.hpp (original)
+++ branches/release/boost/icl/type_traits/interval_type_default.hpp 2011-04-17 17:49:02 EDT (Sun, 17 Apr 2011)
@@ -22,7 +22,7 @@
 namespace boost{ namespace icl
 {
 
- template <class DomainT, ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(std::less, DomainT)>
+ template <class DomainT, ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(ICL_COMPARE_DEFAULT, DomainT)>
     struct interval_type_default
     {
 #ifdef BOOST_ICL_USE_STATIC_BOUNDED_INTERVALS

Modified: branches/release/boost/icl/type_traits/succ_pred.hpp
==============================================================================
--- branches/release/boost/icl/type_traits/succ_pred.hpp (original)
+++ branches/release/boost/icl/type_traits/succ_pred.hpp 2011-04-17 17:49:02 EDT (Sun, 17 Apr 2011)
@@ -1,5 +1,5 @@
 /*-----------------------------------------------------------------------------+
-Copyright (c) 2008-2009: Joachim Faulhaber
+Copyright (c) 2008-2011: Joachim Faulhaber
 +------------------------------------------------------------------------------+
    Distributed under the Boost Software License, Version 1.0.
       (See accompanying file LICENCE.txt or copy at
@@ -8,13 +8,73 @@
 #ifndef BOOST_ICL_TYPE_TRAITS_SUCC_PRED_HPP_JOFA_080913
 #define BOOST_ICL_TYPE_TRAITS_SUCC_PRED_HPP_JOFA_080913
 
+#include <boost/icl/type_traits/is_increasing.hpp>
+
 namespace boost{ namespace icl
 {
- template <class IncrementableT>
- inline static IncrementableT succ(IncrementableT x) { return ++x; }
+template <class IncrementableT>
+inline static IncrementableT succ(IncrementableT x) { return ++x; }
+
+template <class DecrementableT>
+inline static DecrementableT pred(DecrementableT x) { return --x; }
+
+namespace detail
+{
+ template <class DomainT, bool increasing = true>
+ struct successor;
 
- template <class DecrementableT>
- inline static DecrementableT pred(DecrementableT x) { return --x; }
+ template <class DomainT>
+ struct successor<DomainT, true>
+ {
+ typedef successor type;
+ inline static DomainT apply(DomainT value){ return ++value; }
+ };
+
+ template <class DomainT>
+ struct successor<DomainT, false>
+ {
+ typedef successor type;
+ inline static DomainT apply(DomainT value){ return --value; }
+ };
+
+ template <class DomainT, bool increasing = true>
+ struct predecessor;
+
+ template <class DomainT>
+ struct predecessor<DomainT, true>
+ {
+ typedef predecessor type;
+ inline static DomainT apply(DomainT value){ return --value; }
+ };
+
+ template <class DomainT>
+ struct predecessor<DomainT, false>
+ {
+ typedef predecessor type;
+ inline static DomainT apply(DomainT value){ return ++value; }
+ };
+} // namespace detail
+
+//------------------------------------------------------------------------------
+template <class DomainT, class Compare>
+struct successor
+{
+ inline static DomainT apply(DomainT value)
+ {
+ return detail::successor
+ <DomainT, is_increasing<DomainT,Compare>::value>::apply(value);
+ }
+};
+
+template <class DomainT, class Compare>
+struct predecessor
+{
+ inline static DomainT apply(DomainT value)
+ {
+ return detail::predecessor
+ <DomainT, is_increasing<DomainT,Compare>::value>::apply(value);
+ }
+};
 
 }} // namespace boost icl
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk