Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r71362 - in trunk/boost/icl: . concept detail type_traits
From: afojgo_at_[hidden]
Date: 2011-04-17 17:07:37


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

Log:
Added macro BOOST_ICL_USE_COMPARE_STD_GREATER to change container and interval orderings for the library.
This can be used to change the compare-ordering for whole test-programs. (ticket #5482).
Properties modified:
   trunk/boost/icl/ (props changed)
Text files modified:
   trunk/boost/icl/closed_interval.hpp | 2 +-
   trunk/boost/icl/concept/interval.hpp | 7 +++++++
   trunk/boost/icl/continuous_interval.hpp | 2 +-
   trunk/boost/icl/detail/design_config.hpp | 10 ++++++++--
   trunk/boost/icl/detail/std_set.hpp | 7 +++++++
   trunk/boost/icl/discrete_interval.hpp | 2 +-
   trunk/boost/icl/interval.hpp | 2 +-
   trunk/boost/icl/interval_base_map.hpp | 2 +-
   trunk/boost/icl/interval_base_set.hpp | 2 +-
   trunk/boost/icl/interval_map.hpp | 2 +-
   trunk/boost/icl/interval_set.hpp | 2 +-
   trunk/boost/icl/left_open_interval.hpp | 2 +-
   trunk/boost/icl/map.hpp | 2 +-
   trunk/boost/icl/open_interval.hpp | 2 +-
   trunk/boost/icl/right_open_interval.hpp | 2 +-
   trunk/boost/icl/separate_interval_set.hpp | 2 +-
   trunk/boost/icl/split_interval_map.hpp | 2 +-
   trunk/boost/icl/split_interval_set.hpp | 2 +-
   trunk/boost/icl/type_traits/interval_type_default.hpp | 2 +-
   19 files changed, 38 insertions(+), 18 deletions(-)

Modified: trunk/boost/icl/closed_interval.hpp
==============================================================================
--- trunk/boost/icl/closed_interval.hpp (original)
+++ trunk/boost/icl/closed_interval.hpp 2011-04-17 17:07:35 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: trunk/boost/icl/concept/interval.hpp
==============================================================================
--- trunk/boost/icl/concept/interval.hpp (original)
+++ trunk/boost/icl/concept/interval.hpp 2011-04-17 17:07:35 EDT (Sun, 17 Apr 2011)
@@ -897,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;
+}
+
 
 
 //------------------------------------------------------------------------------

Modified: trunk/boost/icl/continuous_interval.hpp
==============================================================================
--- trunk/boost/icl/continuous_interval.hpp (original)
+++ trunk/boost/icl/continuous_interval.hpp 2011-04-17 17:07:35 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: trunk/boost/icl/detail/design_config.hpp
==============================================================================
--- trunk/boost/icl/detail/design_config.hpp (original)
+++ trunk/boost/icl/detail/design_config.hpp 2011-04-17 17:07:35 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: trunk/boost/icl/detail/std_set.hpp
==============================================================================
--- trunk/boost/icl/detail/std_set.hpp (original)
+++ trunk/boost/icl/detail/std_set.hpp 2011-04-17 17:07:35 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: trunk/boost/icl/discrete_interval.hpp
==============================================================================
--- trunk/boost/icl/discrete_interval.hpp (original)
+++ trunk/boost/icl/discrete_interval.hpp 2011-04-17 17:07:35 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:

Modified: trunk/boost/icl/interval.hpp
==============================================================================
--- trunk/boost/icl/interval.hpp (original)
+++ trunk/boost/icl/interval.hpp 2011-04-17 17:07:35 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: trunk/boost/icl/interval_base_map.hpp
==============================================================================
--- trunk/boost/icl/interval_base_map.hpp (original)
+++ trunk/boost/icl/interval_base_map.hpp 2011-04-17 17:07:35 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: trunk/boost/icl/interval_base_set.hpp
==============================================================================
--- trunk/boost/icl/interval_base_set.hpp (original)
+++ trunk/boost/icl/interval_base_set.hpp 2011-04-17 17:07:35 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: trunk/boost/icl/interval_map.hpp
==============================================================================
--- trunk/boost/icl/interval_map.hpp (original)
+++ trunk/boost/icl/interval_map.hpp 2011-04-17 17:07:35 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: trunk/boost/icl/interval_set.hpp
==============================================================================
--- trunk/boost/icl/interval_set.hpp (original)
+++ trunk/boost/icl/interval_set.hpp 2011-04-17 17:07:35 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: trunk/boost/icl/left_open_interval.hpp
==============================================================================
--- trunk/boost/icl/left_open_interval.hpp (original)
+++ trunk/boost/icl/left_open_interval.hpp 2011-04-17 17:07:35 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 left_open_interval
 {
 public:

Modified: trunk/boost/icl/map.hpp
==============================================================================
--- trunk/boost/icl/map.hpp (original)
+++ trunk/boost/icl/map.hpp 2011-04-17 17:07:35 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: trunk/boost/icl/open_interval.hpp
==============================================================================
--- trunk/boost/icl/open_interval.hpp (original)
+++ trunk/boost/icl/open_interval.hpp 2011-04-17 17:07:35 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: trunk/boost/icl/right_open_interval.hpp
==============================================================================
--- trunk/boost/icl/right_open_interval.hpp (original)
+++ trunk/boost/icl/right_open_interval.hpp 2011-04-17 17:07:35 EDT (Sun, 17 Apr 2011)
@@ -19,7 +19,7 @@
 {
 
 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:

Modified: trunk/boost/icl/separate_interval_set.hpp
==============================================================================
--- trunk/boost/icl/separate_interval_set.hpp (original)
+++ trunk/boost/icl/separate_interval_set.hpp 2011-04-17 17:07:35 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: trunk/boost/icl/split_interval_map.hpp
==============================================================================
--- trunk/boost/icl/split_interval_map.hpp (original)
+++ trunk/boost/icl/split_interval_map.hpp 2011-04-17 17:07:35 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: trunk/boost/icl/split_interval_set.hpp
==============================================================================
--- trunk/boost/icl/split_interval_set.hpp (original)
+++ trunk/boost/icl/split_interval_set.hpp 2011-04-17 17:07:35 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: trunk/boost/icl/type_traits/interval_type_default.hpp
==============================================================================
--- trunk/boost/icl/type_traits/interval_type_default.hpp (original)
+++ trunk/boost/icl/type_traits/interval_type_default.hpp 2011-04-17 17:07:35 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


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