Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r50752 - in sandbox/itl: boost/itl boost/itl/type_traits libs/itl/test/test_interval_map_mixed libs/itl_xt/test/meta_functors
From: afojgo_at_[hidden]
Date: 2009-01-24 04:01:14


Author: jofaber
Date: 2009-01-24 04:01:12 EST (Sat, 24 Jan 2009)
New Revision: 50752
URL: http://svn.boost.org/trac/boost/changeset/50752

Log:
Refactored. Added is_binary_intra/inter_combinable<T,U> to further simplify operators o=.
Simplfied intersection interval_maps::operator &=.
Next: Unifying interval_sets::add_intersection to finally have only one definition of &= fa. interval containers.
Stable {msvc-9.0, partly congcc-4.3-a7}

Text files modified:
   sandbox/itl/boost/itl/interval_base_map.hpp | 7
   sandbox/itl/boost/itl/interval_base_set.hpp | 3
   sandbox/itl/boost/itl/interval_map.hpp | 11 +
   sandbox/itl/boost/itl/interval_maps.hpp | 49 ++++++++
   sandbox/itl/boost/itl/interval_set.hpp | 7
   sandbox/itl/boost/itl/map.hpp | 10 +
   sandbox/itl/boost/itl/operators.hpp | 48 --------
   sandbox/itl/boost/itl/separate_interval_set.hpp | 7
   sandbox/itl/boost/itl/set.hpp | 5
   sandbox/itl/boost/itl/split_interval_map.hpp | 7
   sandbox/itl/boost/itl/split_interval_set.hpp | 7
   sandbox/itl/boost/itl/type_traits/is_combinable.hpp | 214 ++++++++++++++++++++++++++++-----------
   sandbox/itl/boost/itl/type_traits/is_map.hpp | 2
   sandbox/itl/boost/itl/type_traits/is_set.hpp | 6
   sandbox/itl/libs/itl/test/test_interval_map_mixed/test_interval_map_mixed.cpp | 3
   sandbox/itl/libs/itl_xt/test/meta_functors/meta_functors.cpp | 21 +--
   16 files changed, 265 insertions(+), 142 deletions(-)

Modified: sandbox/itl/boost/itl/interval_base_map.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_base_map.hpp (original)
+++ sandbox/itl/boost/itl/interval_base_map.hpp 2009-01-24 04:01:12 EST (Sat, 24 Jan 2009)
@@ -180,6 +180,8 @@
     /// The interval type of the map
     typedef Interval<DomainT,Compare> interval_type;
 
+ typedef std::pair<interval_type,CodomainT> interval_mapping_type;
+
     /// The difference type of an interval which is sometimes different form the domain_type
     typedef typename interval_type::difference_type difference_type;
 
@@ -213,8 +215,6 @@
     typedef typename ImplMapT::key_type key_type;
     /// value type of the implementing container
     typedef typename ImplMapT::value_type value_type;
- /// the \c value_type is a \c interval_mapping_type that maps intervals to \c codomain-values
- typedef typename ImplMapT::value_type interval_mapping_type;
     /// data type of the implementing container
     typedef typename ImplMapT::value_type::second_type data_type;
 
@@ -859,6 +859,9 @@
     sub_type* that() { return static_cast<sub_type*>(this); }
     const sub_type* that()const { return static_cast<const sub_type*>(this); }
 
+public:
+ sub_type& self() { return *that(); }
+
 protected:
     ImplMapT _map;
 } ;

Modified: sandbox/itl/boost/itl/interval_base_set.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_base_set.hpp (original)
+++ sandbox/itl/boost/itl/interval_base_set.hpp 2009-01-24 04:01:12 EST (Sat, 24 Jan 2009)
@@ -436,6 +436,9 @@
     sub_type* that() { return static_cast<sub_type*>(this); }
     const sub_type* that()const { return static_cast<const sub_type*>(this); }
 
+public:
+ sub_type& self() { return *that(); }
+
 protected:
     ImplSetT _set;
 } ;

Modified: sandbox/itl/boost/itl/interval_map.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_map.hpp (original)
+++ sandbox/itl/boost/itl/interval_map.hpp 2009-01-24 04:01:12 EST (Sat, 24 Jan 2009)
@@ -140,7 +140,7 @@
     typedef typename base_type::value_type value_type;
     typedef typename base_type::mapping_type mapping_type;
     typedef typename base_type::domain_mapping_type domain_mapping_type;
- typedef typename base_type::interval_mapping_type interval_mapping_type;
+ typedef typename base_type::interval_mapping_type interval_mapping_type;
     typedef typename base_type::ImplMapT ImplMapT;
 
         typedef typename base_type::codomain_combine codomain_combine;
@@ -148,7 +148,7 @@
     typedef interval_set<DomainT,Compare,Interval,Alloc> interval_set_type;
     typedef interval_set_type set_type;
 
- enum { fineness = 0 };
+ enum { fineness = 1 };
 
     /// Default constructor for the empty map
     interval_map(): base_type() {}
@@ -1007,13 +1007,16 @@
 
 template <class KeyT, class DataT, class Traits>
 struct is_set<itl::interval_map<KeyT,DataT,Traits> >
-{ enum{value = true}; };
+{
+ typedef is_set<itl::interval_map<KeyT,DataT,Traits> > type;
+ static const bool value = true;
+};
 
 template <class KeyT, class DataT, class Traits>
 struct is_map<itl::interval_map<KeyT,DataT,Traits> >
 {
         typedef is_map<itl::interval_map<KeyT,DataT,Traits> > type;
- enum{value = true};
+ static const bool value = true;
 };
 
 template <class KeyT, class DataT, class Traits>

Modified: sandbox/itl/boost/itl/interval_maps.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_maps.hpp (original)
+++ sandbox/itl/boost/itl/interval_maps.hpp 2009-01-24 04:01:12 EST (Sat, 24 Jan 2009)
@@ -679,6 +679,20 @@
 //-----------------------------------------------------------------------------
 // intersection &=
 //-----------------------------------------------------------------------------
+template<class ObjectT, class OperandT>
+typename boost::enable_if<is_inter_combinable<ObjectT, OperandT>,
+ ObjectT>::type&
+operator &= (ObjectT& object, const OperandT& operand
+)
+{
+ typedef ObjectT object_type;
+ object_type intersection;
+ object.add_intersection(intersection,operand);
+ object.swap(intersection);
+ return object;
+}
+
+/*CL
 template
 <
         class ObjectT,
@@ -699,11 +713,40 @@
 {
     typedef ObjectT object_type;
     object_type intersection;
- object.add_intersection(intersection,operand);
+ object.add_intersection(intersection, operand);
     object.swap(intersection);
- return object;
+ return object;
+}
+
+
+template
+<
+ class SubType,
+ class DomainT, class CodomainT, class Traits,
+ ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, template<class,ITL_COMPARE>class Interval, ITL_ALLOC Alloc,
+ template
+ <
+ class, class, class,
+ ITL_COMPARE, ITL_COMBINE, ITL_SECTION, template<class,ITL_COMPARE>class, ITL_ALLOC
+ >
+ class IntervalMap
+>
+SubType& operator &=
+(
+ interval_base_map<SubType,DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>& object,
+ const IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>& operand
+)
+{
+ typedef interval_base_map<SubType,DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc> object_type;
+ object_type intersection;
+ object.add_intersection(intersection, operand);
+ object.swap(intersection);
+ return object.self();
+ //return *(static_cast<SubType*>(&object));
 }
+*/
 
+/*
 //-----------------------------------------------------------------------------
 template
 <
@@ -871,7 +914,7 @@
     object.swap(intersection);
     return object;
 }
-
+*/
 
 //-----------------------------------------------------------------------------
 // is_element_equal

Modified: sandbox/itl/boost/itl/interval_set.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_set.hpp (original)
+++ sandbox/itl/boost/itl/interval_set.hpp 2009-01-24 04:01:12 EST (Sat, 24 Jan 2009)
@@ -165,7 +165,7 @@
     /// const_iterator for iteration over intervals
     typedef typename ImplSetT::const_iterator const_iterator;
 
- enum { fineness = 0 };
+ enum { fineness = 1 };
 
 
     // B: Constructors, destructors, assignment
@@ -382,7 +382,10 @@
 
 template <class Type>
 struct is_set<itl::interval_set<Type> >
-{ enum{value = true}; };
+{
+ typedef is_set<itl::interval_set<Type> > type;
+ static const bool value = true;
+};
 
 template <class Type>
 struct is_interval_container<itl::interval_set<Type> >

Modified: sandbox/itl/boost/itl/map.hpp
==============================================================================
--- sandbox/itl/boost/itl/map.hpp (original)
+++ sandbox/itl/boost/itl/map.hpp 2009-01-24 04:01:12 EST (Sat, 24 Jan 2009)
@@ -668,11 +668,17 @@
         //-----------------------------------------------------------------------------
         template <class KeyT, class DataT, class Traits>
         struct is_set<itl::map<KeyT,DataT,Traits> >
- { enum{value = true}; };
+ {
+ typedef is_set<itl::map<KeyT,DataT,Traits> > type;
+ static const bool value = true;
+ };
 
         template <class KeyT, class DataT, class Traits>
         struct is_map<itl::map<KeyT,DataT,Traits> >
- { enum{value = true}; };
+ {
+ typedef is_map<itl::map<KeyT,DataT,Traits> > type;
+ static const bool value = true;
+ };
 
     template <class DomainT, class CodomainT, class Traits>
     struct is_interval_container<itl::map<DomainT,CodomainT,Traits> >

Modified: sandbox/itl/boost/itl/operators.hpp
==============================================================================
--- sandbox/itl/boost/itl/operators.hpp (original)
+++ sandbox/itl/boost/itl/operators.hpp 2009-01-24 04:01:12 EST (Sat, 24 Jan 2009)
@@ -13,55 +13,17 @@
 
 namespace boost{namespace itl
 {
-/*
-//------------------------------------------------------------------------------
-// Addability
-//------------------------------------------------------------------------------
-template<class ObjectT, class OperandT>
-typename boost::enable_if<is_combinable<ObjectT, OperandT>, ObjectT>::type
-operator + (const ObjectT& object, const OperandT& operand)
-{ return ObjectT(object) += operand; }
-
-template<class ObjectT, class OperandT>
-typename boost::enable_if<is_combinable<ObjectT, OperandT>, ObjectT>::type
-operator + (const OperandT& operand, const ObjectT& object)
-{ return ObjectT(object) += operand; }
-
-
-template<class ObjectT>
-ObjectT operator + (const ObjectT& object, const ObjectT& operand)
-{ return ObjectT(object) += operand; }
-
-
-//------------------------------------------------------------------------------
-// Intersection
-//------------------------------------------------------------------------------
-template<class ObjectT, class OperandT>
-typename boost::enable_if<is_combinable<ObjectT, OperandT>, ObjectT>::type
-operator & (const ObjectT& object, const OperandT& operand)
-{ return ObjectT(object) &= operand; }
-
-template<class ObjectT, class OperandT>
-typename boost::enable_if<is_combinable<ObjectT, OperandT>, ObjectT>::type
-operator & (const OperandT& operand, const ObjectT& object)
-{ return ObjectT(object) &= operand; }
-
-template<class ObjectT>
-ObjectT operator & (const typename ObjectT::overloadable_type& object, const ObjectT& operand)
-{ return ObjectT(object) &= operand; }
-*/
-
 
 //------------------------------------------------------------------------------
 // Addability
 //------------------------------------------------------------------------------
 template<class ObjectT, class OperandT>
-typename boost::enable_if<is_intra_combinable<ObjectT, OperandT>, ObjectT>::type
+typename boost::enable_if<is_binary_intra_combinable<ObjectT, OperandT>, ObjectT>::type
 operator + (const ObjectT& object, const OperandT& operand)
 { return ObjectT(object) += operand; }
 
 template<class ObjectT, class OperandT>
-typename boost::enable_if<is_intra_combinable<ObjectT, OperandT>, ObjectT>::type
+typename boost::enable_if<is_binary_intra_combinable<ObjectT, OperandT>, ObjectT>::type
 operator + (const OperandT& operand, const ObjectT& object)
 { return ObjectT(object) += operand; }
 
@@ -75,12 +37,12 @@
 // Intersection
 //------------------------------------------------------------------------------
 template<class ObjectT, class OperandT>
-typename boost::enable_if<is_inter_combinable<ObjectT, OperandT>, ObjectT>::type
+typename boost::enable_if<is_binary_inter_combinable<ObjectT, OperandT>, ObjectT>::type
 operator & (const ObjectT& object, const OperandT& operand)
 { return ObjectT(object) &= operand; }
 
 template<class ObjectT, class OperandT>
-typename boost::enable_if<is_inter_combinable<ObjectT, OperandT>, ObjectT>::type
+typename boost::enable_if<is_binary_inter_combinable<ObjectT, OperandT>, ObjectT>::type
 operator & (const OperandT& operand, const ObjectT& object)
 { return ObjectT(object) &= operand; }
 
@@ -88,8 +50,6 @@
 ObjectT operator & (const typename ObjectT::overloadable_type& object, const ObjectT& operand)
 { return ObjectT(object) &= operand; }
 
-
-
 }} // namespace itl boost
 
 #endif

Modified: sandbox/itl/boost/itl/separate_interval_set.hpp
==============================================================================
--- sandbox/itl/boost/itl/separate_interval_set.hpp (original)
+++ sandbox/itl/boost/itl/separate_interval_set.hpp 2009-01-24 04:01:12 EST (Sat, 24 Jan 2009)
@@ -130,7 +130,7 @@
     typedef typename ImplSetT::const_iterator const_iterator;
 
 
- enum { fineness = 1 };
+ enum { fineness = 2 };
 
 
     // B: Constructors, destructors, assignment
@@ -261,7 +261,10 @@
 
 template <class Type>
 struct is_set<itl::separate_interval_set<Type> >
-{ enum{value = true}; };
+{
+ typedef is_set<itl::separate_interval_set<Type> > type;
+ static const bool value = true;
+};
 
 template <class Type>
 struct is_interval_container<itl::separate_interval_set<Type> >

Modified: sandbox/itl/boost/itl/set.hpp
==============================================================================
--- sandbox/itl/boost/itl/set.hpp (original)
+++ sandbox/itl/boost/itl/set.hpp 2009-01-24 04:01:12 EST (Sat, 24 Jan 2009)
@@ -453,7 +453,10 @@
     //-------------------------------------------------------------------------
     template <class Type>
     struct is_set<itl::set<Type> >
- { enum{value = true}; };
+ {
+ typedef is_set<itl::set<Type> > type;
+ static const bool value = true;
+ };
 
     template <class Type>
     struct is_interval_container<itl::set<Type> >

Modified: sandbox/itl/boost/itl/split_interval_map.hpp
==============================================================================
--- sandbox/itl/boost/itl/split_interval_map.hpp (original)
+++ sandbox/itl/boost/itl/split_interval_map.hpp 2009-01-24 04:01:12 EST (Sat, 24 Jan 2009)
@@ -164,7 +164,7 @@
         typedef interval_set<DomainT,Compare,Interval,Alloc> interval_set_type;
         typedef interval_set_type set_type;
 
- enum { fineness = 2 };
+ enum { fineness = 3 };
 
         /// Default constructor for the empty map
         split_interval_map(): base_type() {}
@@ -777,7 +777,10 @@
 
 template <class KeyT, class DataT, class Traits>
 struct is_set<itl::split_interval_map<KeyT,DataT,Traits> >
-{ enum{value = true}; };
+{
+ typedef is_set<itl::split_interval_map<KeyT,DataT,Traits> > type;
+ static const bool value = true;
+};
 
 template <class KeyT, class DataT, class Traits>
 struct is_map<itl::split_interval_map<KeyT,DataT,Traits> >

Modified: sandbox/itl/boost/itl/split_interval_set.hpp
==============================================================================
--- sandbox/itl/boost/itl/split_interval_set.hpp (original)
+++ sandbox/itl/boost/itl/split_interval_set.hpp 2009-01-24 04:01:12 EST (Sat, 24 Jan 2009)
@@ -148,7 +148,7 @@
         typedef typename ImplSetT::const_iterator const_iterator;
 
 
- enum { fineness = 2 };
+ enum { fineness = 3 };
 
         // B: Constructors, destructors, assignment
         /// Default constructor for the empty set
@@ -421,7 +421,10 @@
 
     template <class Type>
     struct is_set<itl::split_interval_set<Type> >
- { enum{value = true}; };
+ {
+ typedef is_set<itl::split_interval_set<Type> > type;
+ static const bool value = true;
+ };
 
     template <class Type>
     struct is_interval_container<itl::split_interval_set<Type> >

Modified: sandbox/itl/boost/itl/type_traits/is_combinable.hpp
==============================================================================
--- sandbox/itl/boost/itl/type_traits/is_combinable.hpp (original)
+++ sandbox/itl/boost/itl/type_traits/is_combinable.hpp 2009-01-24 04:01:12 EST (Sat, 24 Jan 2009)
@@ -26,36 +26,6 @@
 };
 
 
-
-template<class Type, class AssociateT>
-struct is_combinable;
-
-template<class Type>
-struct is_combinable<Type, typename Type::value_type>
-{ enum{ value = is_overloadable<Type>::value }; };
-
-template<class Type>
-struct is_combinable<Type, typename Type::domain_mapping_type>
-{ enum{ value = is_overloadable<Type>::value }; };
-
-template<class Type>
-struct is_combinable<Type, typename Type::joint_type>
-{ enum{ value = is_overloadable<Type>::value }; };
-
-template<class Type>
-struct is_combinable<Type, typename Type::separate_type>
-{
- enum{ value = mpl::and_<is_interval_splitter<Type>, is_overloadable<Type> >::value };
-};
-
-template<class Type, class AssociateT>
-struct is_combinable
-{
- enum{ value = false };
-};
-
-//==============================================================================
-//==============================================================================
 template<class Type>
 struct is_interval_map
 {
@@ -102,16 +72,58 @@
 
 template<class Type>
 struct is_interval_map_derivative<Type, typename Type::domain_mapping_type>
-{ enum{ value = is_interval_container<Type>::value }; };
+{
+ typedef is_interval_map_derivative<Type, typename Type::domain_mapping_type> type;
+ static const bool value = is_interval_container<Type>::value;
+};
 
 template<class Type>
 struct is_interval_map_derivative<Type, typename Type::interval_mapping_type>
-{ enum{ value = is_interval_container<Type>::value }; };
+{
+ typedef is_interval_map_derivative<Type, typename Type::interval_mapping_type> type;
+ static const bool value = is_interval_container<Type>::value;
+};
+
+template<class Type>
+struct is_interval_map_derivative<Type, typename Type::value_type>
+{
+ typedef is_interval_map_derivative<Type, typename Type::value_type> type;
+ static const bool value = is_interval_container<Type>::value;
+};
 
 template<class Type, class AssociateT>
 struct is_interval_map_derivative
 {
- enum{ value = false };
+ typedef is_interval_map_derivative<Type, AssociateT> type;
+ static const bool value = is_interval_container<Type>::value;
+};
+
+
+
+
+//------------------------------------------------------------------------------
+//- segmentational_fineness
+//------------------------------------------------------------------------------
+template<class Type> struct unknown_fineness
+{
+ typedef unknown_fineness<Type> type;
+ static const int value = 0;
+};
+
+template<class Type> struct known_fineness
+{
+ typedef known_fineness<Type> type;
+ static const int value = Type::fineness;
+};
+
+template<class Type>struct segmentational_fineness
+{
+ typedef segmentational_fineness<Type> type;
+ static const int value =
+ mpl::if_<is_interval_container<Type>,
+ known_fineness<Type>,
+ unknown_fineness<Type>
+ >::type::value;
 };
 
 
@@ -134,7 +146,7 @@
         typedef IntervalSet2<Dom,Cmp,Itv,Alc> CompanionT;
         typedef is_interval_set_companion<GuideT,CompanionT> type;
 
- enum{ value = CompanionT::fineness < GuideT::fineness };
+ static const bool value = true;
 };
 
 // Every IntervalSet can be a companion of every IntervalMap for
@@ -154,7 +166,7 @@
         typedef IntervalSet<Dom, Cmp, Itv,Alc> CompanionT;
         typedef is_interval_set_companion<GuideT,CompanionT> type;
 
- enum{ value = true };
+ static const bool value = true;
 };
 
 template<class GuideT, class CompanionT> struct is_interval_set_companion
@@ -185,7 +197,7 @@
         typedef IntervalMap2<Dom,Cod,Trt,Cmp,Cmb,Sec,Itv,Alc> CompanionT;
         typedef is_interval_map_companion<GuideT,CompanionT> type;
 
- enum{ value = CompanionT::fineness < GuideT::fineness };
+ static const bool value = true;
 };
 
 template<class GuideT, class CompanionT> struct is_interval_map_companion
@@ -195,6 +207,33 @@
 };
 
 
+
+
+//------------------------------------------------------------------------------
+//- is_coarser_interval_{set,map}_companion
+//------------------------------------------------------------------------------
+template<class GuideT, class CompanionT>
+struct is_coarser_interval_set_companion
+{
+ typedef is_coarser_interval_set_companion<GuideT, CompanionT> type;
+ static const bool value =
+ is_interval_set_companion<GuideT, CompanionT>::value
+ && ( segmentational_fineness<GuideT>::value
+ > segmentational_fineness<CompanionT>::value);
+};
+
+template<class GuideT, class CompanionT>
+struct is_coarser_interval_map_companion
+{
+ typedef is_coarser_interval_map_companion<GuideT, CompanionT> type;
+ static const bool value =
+ is_interval_map_companion<GuideT, CompanionT>::value
+ && ( segmentational_fineness<GuideT>::value
+ > segmentational_fineness<CompanionT>::value);
+};
+
+
+
 //------------------------------------------------------------------------------
 // is_interval_{set,map}_combinable
 //------------------------------------------------------------------------------
@@ -222,44 +261,95 @@
 struct is_intra_combinable
 {
         typedef is_intra_combinable<GuideT,CompanionT> type;
- enum
- { value = mpl::or_
- <
- mpl::and_< is_interval_map<GuideT>
- , is_interval_map_companion<GuideT, CompanionT> >
- , mpl::and_< is_interval_set<GuideT>
- , is_interval_set_companion<GuideT, CompanionT> >
- >::value
- };
+ static const bool value =
+ mpl::or_<is_interval_set_combinable<GuideT, CompanionT>,
+ is_interval_map_combinable<GuideT, CompanionT>
+ >::value;
 };
 
 template<class GuideT, class CompanionT>
 struct is_cross_combinable
 {
         typedef is_cross_combinable<GuideT,CompanionT> type;
- enum
- { value = mpl::and_
- < is_interval_map<GuideT>
- , mpl::or_< is_interval_map_companion<GuideT, CompanionT>
- , is_interval_set_companion<GuideT, CompanionT>
- >
- >::value
- };
+ static const bool value =
+ mpl::and_
+ < is_interval_map<GuideT>
+ , mpl::or_< is_interval_map_companion<GuideT, CompanionT>
+ , is_interval_set_companion<GuideT, CompanionT> >
+ >::value;
 };
 
 template<class GuideT, class CompanionT>
 struct is_inter_combinable
 {
         typedef is_inter_combinable<GuideT,CompanionT> type;
- enum
- { value = mpl::or_
- <
- mpl::and_<is_interval_map<GuideT>,
- is_cross_combinable<GuideT, CompanionT> >
- , mpl::and_<is_interval_set<GuideT>,
- is_intra_combinable<GuideT, CompanionT> >
- >::value
- };
+ static const bool value =
+ mpl::or_
+ <
+ mpl::and_<is_interval_map<GuideT>,
+ is_cross_combinable<GuideT, CompanionT> >
+ , mpl::and_<is_interval_set<GuideT>,
+ is_intra_combinable<GuideT, CompanionT> >
+ >::value;
+};
+
+//------------------------------------------------------------------------------
+// is_binary_interval_{set,map}_combinable
+//------------------------------------------------------------------------------
+template<class GuideT, class CompanionT>
+struct is_binary_interval_set_combinable
+{
+ typedef is_binary_interval_set_combinable<GuideT,CompanionT> type;
+ enum{ value = mpl::and_< is_interval_set<GuideT>
+ , is_coarser_interval_set_companion<GuideT, CompanionT>
+ >::value
+ };
+};
+
+template<class GuideT, class CompanionT>
+struct is_binary_interval_map_combinable
+{
+ typedef is_binary_interval_map_combinable<GuideT,CompanionT> type;
+ enum{ value = mpl::and_< is_interval_map<GuideT>
+ , is_coarser_interval_map_companion<GuideT, CompanionT>
+ >::value
+ };
+};
+
+template<class GuideT, class CompanionT>
+struct is_binary_intra_combinable
+{
+ typedef is_binary_intra_combinable<GuideT,CompanionT> type;
+ static const bool value =
+ mpl::or_<is_binary_interval_set_combinable<GuideT, CompanionT>,
+ is_binary_interval_map_combinable<GuideT, CompanionT>
+ >::value;
+};
+
+template<class GuideT, class CompanionT>
+struct is_binary_cross_combinable
+{
+ typedef is_binary_cross_combinable<GuideT,CompanionT> type;
+ static const bool value =
+ mpl::and_
+ < is_interval_map<GuideT>
+ , mpl::or_< is_coarser_interval_map_companion<GuideT, CompanionT>
+ , is_interval_set_companion<GuideT, CompanionT> >
+ >::value;
+};
+
+template<class GuideT, class CompanionT>
+struct is_binary_inter_combinable
+{
+ typedef is_binary_inter_combinable<GuideT,CompanionT> type;
+ static const bool value =
+ mpl::or_
+ <
+ mpl::and_<is_interval_map<GuideT>,
+ is_binary_cross_combinable<GuideT, CompanionT> >
+ , mpl::and_<is_interval_set<GuideT>,
+ is_binary_intra_combinable<GuideT, CompanionT> >
+ >::value;
 };
 
 

Modified: sandbox/itl/boost/itl/type_traits/is_map.hpp
==============================================================================
--- sandbox/itl/boost/itl/type_traits/is_map.hpp (original)
+++ sandbox/itl/boost/itl/type_traits/is_map.hpp 2009-01-24 04:01:12 EST (Sat, 24 Jan 2009)
@@ -15,7 +15,7 @@
     template <class Type> struct is_map
         {
                 typedef is_map<Type> type;
- enum {value = false};
+ static const bool value = false;
         };
 
 }} // namespace boost itl

Modified: sandbox/itl/boost/itl/type_traits/is_set.hpp
==============================================================================
--- sandbox/itl/boost/itl/type_traits/is_set.hpp (original)
+++ sandbox/itl/boost/itl/type_traits/is_set.hpp 2009-01-24 04:01:12 EST (Sat, 24 Jan 2009)
@@ -12,7 +12,11 @@
 {
     template <class Type> struct is_set;
 
- template <class Type> struct is_set{ enum {value = false}; };
+ template <class Type> struct is_set
+ {
+ typedef is_set<Type> type;
+ static const bool value = false;
+ };
 
 }} // namespace boost itl
 

Modified: sandbox/itl/libs/itl/test/test_interval_map_mixed/test_interval_map_mixed.cpp
==============================================================================
--- sandbox/itl/libs/itl/test/test_interval_map_mixed/test_interval_map_mixed.cpp (original)
+++ sandbox/itl/libs/itl/test/test_interval_map_mixed/test_interval_map_mixed.cpp 2009-01-24 04:01:12 EST (Sat, 24 Jan 2009)
@@ -783,8 +783,7 @@
     std::pair<interval<T>,U> I1_3D_1(I1_3D, u1);
     std::pair<interval<T>,U> I1_3D_2(I1_3D, u2);
     std::pair<interval<T>,U> I1_8D_1(I1_8D, u1);
- //typename SplitIntervalMapT::value_type I1_8D_1(I1_8D, u1);
- std::pair<interval<T>,U> I2_7D_1(I2_7D, u1);
+ std::pair<const interval<T>,U> I2_7D_1(I2_7D, u1);
     std::pair<interval<T>,U> I2_3D_1(I2_3D, u1);
     std::pair<interval<T>,U> I2_3D_3(I2_3D, u3);
     std::pair<interval<T>,U> I6_7D_1(I6_7D, u1);

Modified: sandbox/itl/libs/itl_xt/test/meta_functors/meta_functors.cpp
==============================================================================
--- sandbox/itl/libs/itl_xt/test/meta_functors/meta_functors.cpp (original)
+++ sandbox/itl/libs/itl_xt/test/meta_functors/meta_functors.cpp 2009-01-24 04:01:12 EST (Sat, 24 Jan 2009)
@@ -250,18 +250,15 @@
         cout << "sec_map: " << sec_map << endl;
 }
 
-void assert_test()
+void misc_test()
 {
- //interval<double> doubItv = interval<double>::closed(0.0, 1.5);
- //double fst = doubItv.first();
- interval<int> intItv = interval<int>::closed(0, 2);
- int fst = intItv.first();
- cout << " c: "<< itl::closed_bounded << endl;
- cout << "c&o: "<< (itl::closed_bounded & itl::open_bounded)<< endl;
- cout << " !c: "<< !(itl::closed_bounded)<< endl;
- cout << " !o: "<< !(itl::open_bounded)<< endl;
- cout << "2>>1: "<< (2 >> 1) << endl;
- cout << "0>>1: "<< (0 >> 1) << endl;
+ typedef interval_map<int,int> IMT;
+
+ cout << "f=" << segmentational_fineness<IMT>::value << endl;
+ cout << "IMT > IMT::valueT =" << is_coarser_interval_map_companion<IMT, IMT::value_type>::value << endl;
+ cout << "IMT > IMT::valueT =" << is_interval_map_companion<IMT, IMT::value_type>::value << endl;
+ cout << "IMT > IMT::eleT =" << is_coarser_interval_map_companion<IMT, IMT::domain_mapping_type>::value << endl;
+ cout << "IMT > IMT::eleT =" << is_interval_map_companion<IMT, IMT::domain_mapping_type>::value << endl;
 }
 
 int main()
@@ -282,7 +279,7 @@
         //codomain_test();
         //string_codomain_test();
         //quantifier_subtract_test();
- assert_test();
+ misc_test();
     return 0;
 }
 


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