Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r50714 - in sandbox/itl: boost/itl boost/itl/type_traits libs/itl/test libs/itl/test/test_interval_map libs/itl/test/test_quantifier_map libs/itl/test/test_split_interval_map
From: afojgo_at_[hidden]
Date: 2009-01-21 16:24:26


Author: jofaber
Date: 2009-01-21 16:24:25 EST (Wed, 21 Jan 2009)
New Revision: 50714
URL: http://svn.boost.org/trac/boost/changeset/50714

Log:
Refactored. Introduce IntervalMaps::domain_mapping_type and interval_mapping_type.
Added is_interval_{set/map} derivative and companion for better overload resolution.
Stable {msvc-9.0, partly congcc-4.3-a7}

Text files modified:
   sandbox/itl/boost/itl/interval_base_map.hpp | 18 ++--
   sandbox/itl/boost/itl/interval_map.hpp | 7 +
   sandbox/itl/boost/itl/interval_maps.hpp | 12 +-
   sandbox/itl/boost/itl/interval_set.hpp | 1
   sandbox/itl/boost/itl/operators.hpp | 41 ++++++++++
   sandbox/itl/boost/itl/separate_interval_set.hpp | 1
   sandbox/itl/boost/itl/split_interval_map.hpp | 7 +
   sandbox/itl/boost/itl/split_interval_set.hpp | 1
   sandbox/itl/boost/itl/type_traits/is_combinable.hpp | 112 +++++++++++++++++++++++++---
   sandbox/itl/libs/itl/test/test_interval_map/test_interval_map_shared.cpp | 4
   sandbox/itl/libs/itl/test/test_interval_map_shared.hpp | 158 ++++++++++-----------------------------
   sandbox/itl/libs/itl/test/test_quantifier_map/test_quantifier_map.cpp | 2
   sandbox/itl/libs/itl/test/test_quantifier_map_shared.hpp | 43 +++++++++-
   sandbox/itl/libs/itl/test/test_split_interval_map/test_split_interval_map_shared.cpp | 3
   sandbox/itl/libs/itl/test/test_value_maker.hpp | 6
   15 files changed, 256 insertions(+), 160 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-21 16:24:25 EST (Wed, 21 Jan 2009)
@@ -176,7 +176,7 @@
     /// basic value type
     typedef std::pair<domain_type,codomain_type> mapping_type;
     /// Auxiliary type to help the compiler resolve ambiguities when using std::make_pair
- typedef mapping_pair<domain_type,codomain_type> mapping_pair_type;
+ typedef mapping_pair<domain_type,codomain_type> domain_mapping_type;
     /// The interval type of the map
     typedef Interval<DomainT,Compare> interval_type;
 
@@ -213,6 +213,8 @@
     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;
 
@@ -287,7 +289,7 @@
 
     //--- contains: map view ------------------------------------------------------
     /// Does the map contain the element pair <tt>x = (key_element,value)</tt>?
- bool contains(const mapping_pair_type& x)const
+ bool contains(const domain_mapping_type& x)const
         { return that()->contains_(value_type(interval_type(x.key), x.data)); }
 
     /// Does the map contain all element value pairs represented by the interval-value pair sub?
@@ -383,7 +385,7 @@
         Addition and subtraction are reversible as follows:
         <tt>m0=m; m.add(x); m.subtract(x);</tt> implies <tt>m==m0 </tt>
     */
- SubType& add(const mapping_pair_type& x)
+ SubType& add(const domain_mapping_type& x)
     { return add( value_type(interval_type(x.key), x.data) ); }
 
     /// Addition of a base value pair.
@@ -453,7 +455,7 @@
         Insertion and subtraction are reversible as follows:
         <tt>m0=m; m.add(x); m.subtract(x);</tt> implies <tt>m==m0 </tt>
     */
- SubType& subtract(const mapping_pair_type& x)
+ SubType& subtract(const domain_mapping_type& x)
     {
                 return subtract( value_type(interval_type(x.key), x.data) );
     }
@@ -496,7 +498,7 @@
 
         This is the insertion semantics known from std::map::insert.
     */
- SubType& insert(const mapping_pair_type& x)
+ SubType& insert(const domain_mapping_type& x)
     {
                 that()->insert(value_type(interval_type(x.key), x.data));
         return *that();
@@ -517,7 +519,7 @@
         { that()->insert_(x); return *that(); }
 
 
- SubType& set(const mapping_pair_type& x)
+ SubType& set(const domain_mapping_type& x)
     {
                 that()->set(value_type(interval_type(x.key), x.data));
         return *that();
@@ -536,7 +538,7 @@
         This does erase a base value pair <tt>x=(k,y)</tt> form the map, if
         a value \c y is stored for key \c k.
     */
- SubType& erase(const mapping_pair_type& x)
+ SubType& erase(const domain_mapping_type& x)
     {
                 that()->erase_(value_type(interval_type(x.key), x.data));
         return *that();
@@ -634,7 +636,7 @@
     void add_intersection(interval_base_map& section, const domain_type& x)const
     { add_intersection(section, interval_type(x)); }
 
- void add_intersection(interval_base_map& section, const mapping_pair_type& x)const
+ void add_intersection(interval_base_map& section, const domain_mapping_type& x)const
     { add_intersection(section, value_type(interval_type(x.key), x.data)); }
 
     /// Intersection with an interval value pair

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-21 16:24:25 EST (Wed, 21 Jan 2009)
@@ -139,7 +139,8 @@
     typedef typename base_type::iterator iterator;
     typedef typename base_type::value_type value_type;
     typedef typename base_type::mapping_type mapping_type;
- typedef typename base_type::mapping_pair_type mapping_pair_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::ImplMapT ImplMapT;
 
         typedef typename base_type::codomain_combine codomain_combine;
@@ -147,6 +148,8 @@
     typedef interval_set<DomainT,Compare,Interval,Alloc> interval_set_type;
     typedef interval_set_type set_type;
 
+ enum { fineness = 0 };
+
     /// Default constructor for the empty map
     interval_map(): base_type() {}
     /// Copy constructor
@@ -160,7 +163,7 @@
                                  Traits,Compare,Combine,Section,Interval,Alloc>& src)
     { assign(src); }
 
- explicit interval_map(mapping_pair_type& base_pair): base_type()
+ explicit interval_map(domain_mapping_type& base_pair): base_type()
     { add(base_pair); }
 
     explicit interval_map(const value_type& value_pair): base_type()

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-21 16:24:25 EST (Wed, 21 Jan 2009)
@@ -133,7 +133,7 @@
 operator +=
 (
           IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>& object,
- const typename IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>::mapping_pair_type& operand
+ const typename IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>::domain_mapping_type& operand
 )
 {
     return object.add(operand);
@@ -308,7 +308,7 @@
 operator |=
 (
           IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>& object,
- const typename IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>::mapping_pair_type& operand
+ const typename IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>::domain_mapping_type& operand
 )
 {
     return object.add(operand);
@@ -330,7 +330,7 @@
 operator |
 (
     const IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>& object,
- const typename IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>::mapping_pair_type& operand
+ const typename IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>::domain_mapping_type& operand
 )
 {
         typedef IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc> ObjectT;
@@ -516,7 +516,7 @@
 operator -=
 (
           IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>& object,
- const typename IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>::mapping_pair_type& operand
+ const typename IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>::domain_mapping_type& operand
 )
 {
     return object.subtract(operand);
@@ -537,7 +537,7 @@
 operator -
 (
     const IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>& object,
- const typename IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>::mapping_pair_type& operand
+ const typename IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>::domain_mapping_type& operand
 )
 {
         typedef IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc> ObjectT;
@@ -775,7 +775,7 @@
 operator &=
 (
           IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>& object,
- const typename IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>::mapping_pair_type& operand
+ const typename IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>::domain_mapping_type& operand
 )
 {
     typedef IntervalMap<DomainT,CodomainT,

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-21 16:24:25 EST (Wed, 21 Jan 2009)
@@ -165,6 +165,7 @@
     /// const_iterator for iteration over intervals
     typedef typename ImplSetT::const_iterator const_iterator;
 
+ enum { fineness = 0 };
 
 
     // B: Constructors, destructors, assignment

Modified: sandbox/itl/boost/itl/operators.hpp
==============================================================================
--- sandbox/itl/boost/itl/operators.hpp (original)
+++ sandbox/itl/boost/itl/operators.hpp 2009-01-21 16:24:25 EST (Wed, 21 Jan 2009)
@@ -13,6 +13,7 @@
 
 namespace boost{namespace itl
 {
+/*
 //------------------------------------------------------------------------------
 // Addability
 //------------------------------------------------------------------------------
@@ -48,6 +49,46 @@
 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_interval_map_companion<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_interval_map_companion<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; }
+
+
+//------------------------------------------------------------------------------
+// Intersection
+//------------------------------------------------------------------------------
+template<class ObjectT, class OperandT>
+typename boost::enable_if<is_interval_set_companion<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_interval_set_companion<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; }
+
+
 
 }} // namespace itl boost
 

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-21 16:24:25 EST (Wed, 21 Jan 2009)
@@ -130,6 +130,7 @@
     typedef typename ImplSetT::const_iterator const_iterator;
 
 
+ enum { fineness = 1 };
 
 
     // B: Constructors, destructors, assignment

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-21 16:24:25 EST (Wed, 21 Jan 2009)
@@ -155,7 +155,8 @@
         typedef typename base_type::iterator iterator;
         typedef typename base_type::value_type value_type;
         typedef typename base_type::mapping_type mapping_type;
- typedef typename base_type::mapping_pair_type mapping_pair_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::ImplMapT ImplMapT;
 
         typedef typename base_type::codomain_combine codomain_combine;
@@ -163,12 +164,14 @@
         typedef interval_set<DomainT,Compare,Interval,Alloc> interval_set_type;
         typedef interval_set_type set_type;
 
+ enum { fineness = 2 };
+
         /// Default constructor for the empty map
         split_interval_map(): base_type() {}
         /// Copy constructor
         split_interval_map(const split_interval_map& src): base_type(src) {}
 
- explicit split_interval_map(mapping_pair_type& base_pair): base_type()
+ explicit split_interval_map(domain_mapping_type& base_pair): base_type()
         { add(base_pair); }
 
         explicit split_interval_map(const value_type& value_pair): base_type()

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-21 16:24:25 EST (Wed, 21 Jan 2009)
@@ -148,6 +148,7 @@
         typedef typename ImplSetT::const_iterator const_iterator;
 
 
+ enum { fineness = 2 };
 
         // B: Constructors, destructors, assignment
         /// Default constructor for the empty set

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-21 16:24:25 EST (Wed, 21 Jan 2009)
@@ -33,11 +33,7 @@
 { enum{ value = is_overloadable<Type>::value }; };
 
 template<class Type>
-struct is_combinable<Type, typename Type::mapping_pair_type>
-{ enum{ value = is_overloadable<Type>::value }; };
-
-template<class Type>
-struct is_combinable<Type, typename Type::base_type>
+struct is_combinable<Type, typename Type::domain_mapping_type>
 { enum{ value = is_overloadable<Type>::value }; };
 
 template<class Type>
@@ -56,20 +52,112 @@
         enum{ value = false };
 };
 
-/*
+
+
+
+//------------------------------------------------------------------------------
+// is_interval_set_derivative
+//------------------------------------------------------------------------------
 template<class Type, class AssociateT>
-struct is_combinable2;
+struct is_interval_set_derivative;
 
 template<class Type>
-struct is_combinable2<Type, typename Type::interval_type>
-{ enum{ value = is_overloadable<Type>::value }; };
+struct is_interval_set_derivative<Type, typename Type::domain_type>
+{ enum{ value = is_interval_container<Type>::value }; };
+
+template<class Type>
+struct is_interval_set_derivative<Type, typename Type::interval_type>
+{ enum{ value = is_interval_container<Type>::value }; };
+
+template<class Type, class AssociateT>
+struct is_interval_set_derivative
+{
+ enum{ value = false };
+};
+
+//------------------------------------------------------------------------------
+// is_interval_map_derivative
+//------------------------------------------------------------------------------
+template<class Type, class AssociateT>
+struct is_interval_map_derivative;
+
+template<class Type>
+struct is_interval_map_derivative<Type, typename Type::domain_mapping_type>
+{ enum{ 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 }; };
 
 template<class Type, class AssociateT>
-struct is_combinable2
+struct is_interval_map_derivative
+{
+ enum{ value = false };
+};
+
+
+
+//------------------------------------------------------------------------------
+// is_interval_set_companion
+//------------------------------------------------------------------------------
+template<class Type, class CompanionT> struct is_interval_set_companion;
+
+template
+<
+ class Dom, ITL_COMPARE Cmp, template<class,ITL_COMPARE>class Itv, ITL_ALLOC Alc,
+ template<class, ITL_COMPARE, template<class,ITL_COMPARE>class, ITL_ALLOC>class IntervalSet1,
+ template<class, ITL_COMPARE, template<class,ITL_COMPARE>class, ITL_ALLOC>class IntervalSet2
+>
+struct is_interval_set_companion<IntervalSet1<Dom,Cmp,Itv,Alc>,
+ IntervalSet2<Dom,Cmp,Itv,Alc> >
+{
+ enum{ value = IntervalSet2<Dom,Cmp,Itv,Alc>::fineness
+ < IntervalSet1<Dom,Cmp,Itv,Alc>::fineness };
+};
+
+// Every IntervalSet can be a companion of every IntervalMap for
+// operations intersection and erase.
+template
+<
+ class Dom, class Cod, class Trt, ITL_COMPARE Cmp, ITL_COMBINE Cmb, ITL_SECTION Sec,
+ template<class,ITL_COMPARE>class Itv, ITL_ALLOC Alc,
+ template<class, class, class, ITL_COMPARE, ITL_COMBINE, ITL_SECTION,
+ template<class,ITL_COMPARE>class, ITL_ALLOC>class IntervalMap,
+ template<class, ITL_COMPARE, template<class,ITL_COMPARE>class, ITL_ALLOC>class IntervalSet
+>
+struct is_interval_set_companion<IntervalMap<Dom,Cod,Trt,Cmp,Cmb,Sec,Itv,Alc>,
+ IntervalSet<Dom, Cmp, Itv,Alc> >
+{ enum{ value = true }; };
+
+template<class Type, class CompanionT> struct is_interval_set_companion
+{ enum{ value = is_interval_set_derivative<Type,CompanionT>::value }; };
+
+
+//------------------------------------------------------------------------------
+// is_interval_map_companion
+//------------------------------------------------------------------------------
+template<class Type, class CompanionT> struct is_interval_map_companion;
+
+template
+<
+ class Dom, class Cod, class Trt, ITL_COMPARE Cmp, ITL_COMBINE Cmb, ITL_SECTION Sec,
+ template<class,ITL_COMPARE>class Itv, ITL_ALLOC Alc,
+ template<class, class, class, ITL_COMPARE, ITL_COMBINE, ITL_SECTION,
+ template<class,ITL_COMPARE>class, ITL_ALLOC>class IntervalMap1,
+ template<class, class, class, ITL_COMPARE, ITL_COMBINE, ITL_SECTION,
+ template<class,ITL_COMPARE>class, ITL_ALLOC>class IntervalMap2
+>
+struct is_interval_map_companion<IntervalMap1<Dom,Cod,Trt,Cmp,Cmb,Sec,Itv,Alc>,
+ IntervalMap2<Dom,Cod,Trt,Cmp,Cmb,Sec,Itv,Alc> >
 {
- enum{ value = is_combinable2<Type, AssociateT>::value };
+ enum{ value = IntervalMap2<Dom,Cod,Trt,Cmp,Cmb,Sec,Itv,Alc>::fineness
+ < IntervalMap1<Dom,Cod,Trt,Cmp,Cmb,Sec,Itv,Alc>::fineness };
 };
-*/
+
+template<class Type, class CompanionT> struct is_interval_map_companion
+{ enum{ value = is_interval_map_derivative<Type,CompanionT>::value }; };
+
+
 
 }} // namespace itl boost
 

Modified: sandbox/itl/libs/itl/test/test_interval_map/test_interval_map_shared.cpp
==============================================================================
--- sandbox/itl/libs/itl/test/test_interval_map/test_interval_map_shared.cpp (original)
+++ sandbox/itl/libs/itl/test/test_interval_map/test_interval_map_shared.cpp 2009-01-21 16:24:25 EST (Wed, 21 Jan 2009)
@@ -51,6 +51,6 @@
 { interval_map_base_is_disjoint_4_bicremental_types<interval_map, T, int>();}
 
 BOOST_AUTO_TEST_CASE_TEMPLATE
-(test_itl_interval_map_base_laws_plus_4_bicremental_types, T, bicremental_types)
-{ interval_map_base_laws_plus_4_bicremental_types<T, int, interval_map, split_interval_map>();}
+(test_itl_interval_map_infix_plus_overload_4_bicremental_types, T, bicremental_types)
+{ interval_map_infix_plus_overload_4_bicremental_types<interval_map, T, int>();}
 

Modified: sandbox/itl/libs/itl/test/test_interval_map_shared.hpp
==============================================================================
--- sandbox/itl/libs/itl/test/test_interval_map_shared.hpp (original)
+++ sandbox/itl/libs/itl/test/test_interval_map_shared.hpp 2009-01-21 16:24:25 EST (Wed, 21 Jan 2009)
@@ -74,8 +74,8 @@
     BOOST_CHECK_EQUAL(mt_map, IntervalMapT());
 
     //subtracting elements form emptieness
- typename IntervalMapT::mapping_pair_type v0_u1 = make_pair(v0,u1);
- typename IntervalMapT::mapping_pair_type v1_u1 = make_pair(v1,u1);
+ typename IntervalMapT::domain_mapping_type v0_u1 = make_pair(v0,u1);
+ typename IntervalMapT::domain_mapping_type v1_u1 = make_pair(v1,u1);
     //mt_map.subtract(make_pair(v0,u1)).subtract(make_pair(v1,u1));
     mt_map.subtract(v0_u1).subtract(v1_u1);
     BOOST_CHECK_EQUAL(mt_map, IntervalMapT());
@@ -175,7 +175,7 @@
     T v4 = make<T>(4);
     U u2 = make<U>(2);
     interval<T> I4_4I(v4);
- typename IntervalMapT::mapping_pair_type v4_u2(v4,u2);
+ typename IntervalMapT::domain_mapping_type v4_u2(v4,u2);
     typename IntervalMapT::value_type I4_4I_u2(I4_4I,u2);
 
     IntervalMapT _I4_4I_u2;
@@ -243,8 +243,8 @@
     interval<T> I5_6I(v5,v6);
     interval<T> I5_9I(v5,v9);
     interval<T> I0_9I = interval<T>::closed(v0, v9);
- typename IntervalMapT::mapping_pair_type v0_u1 = make_pair(v0, u1);
- typename IntervalMapT::mapping_pair_type v9_u1 = make_pair(v9, u1);
+ typename IntervalMapT::domain_mapping_type v0_u1 = make_pair(v0, u1);
+ typename IntervalMapT::domain_mapping_type v9_u1 = make_pair(v9, u1);
     typename IntervalMapT::value_type I5_6I_u1 = make_pair(I5_6I, u1);
     typename IntervalMapT::value_type I5_9I_u1 = make_pair(I5_9I, u1);
     typename IntervalMapT::value_type I0_9I_u1 = make_pair(interval<T>::closed(v0, v9), u1);
@@ -295,9 +295,9 @@
     T v3 = make<T>(3);
     T v5 = make<T>(5);
     U u1 = make<U>(1);
- typename IntervalMapT::mapping_pair_type v1_u1(v1,u1);
- typename IntervalMapT::mapping_pair_type v3_u1(v3,u1);
- typename IntervalMapT::mapping_pair_type v5_u1(v5,u1);
+ typename IntervalMapT::domain_mapping_type v1_u1(v1,u1);
+ typename IntervalMapT::domain_mapping_type v3_u1(v3,u1);
+ typename IntervalMapT::domain_mapping_type v5_u1(v5,u1);
 
     size_T s3 = make<size_T>(3);
 
@@ -328,9 +328,9 @@
     T v3 = make<T>(3);
     T v5 = make<T>(5);
     U u1 = make<U>(1);
- typename IntervalMapT::mapping_pair_type v1_u1(v1,u1);
- typename IntervalMapT::mapping_pair_type v3_u1(v3,u1);
- typename IntervalMapT::mapping_pair_type v5_u1(v5,u1);
+ typename IntervalMapT::domain_mapping_type v1_u1(v1,u1);
+ typename IntervalMapT::domain_mapping_type v3_u1(v3,u1);
+ typename IntervalMapT::domain_mapping_type v5_u1(v5,u1);
 
     size_T s3 = make<size_T>(3);
     diff_T d0 = make<diff_T>(0);
@@ -436,9 +436,9 @@
     T v11 = make<T>(11);
     U u1 = make<U>(1);
     
- typename IntervalMapT::mapping_pair_type v3_u1(v3,u1);
- typename IntervalMapT::mapping_pair_type v9_u1(v9,u1);
- typename IntervalMapT::mapping_pair_type v11_u1(v11,u1);
+ typename IntervalMapT::domain_mapping_type v3_u1(v3,u1);
+ typename IntervalMapT::domain_mapping_type v9_u1(v9,u1);
+ typename IntervalMapT::domain_mapping_type v11_u1(v11,u1);
 
     typename IntervalMapT::value_type I3_7I_u1(interval<T>(v3,v7),u1);
     IntervalMapT im(v3_u1);
@@ -495,29 +495,6 @@
     //complement.erase(I3_5I);
     complement.erase(section);
     BOOST_CHECK_EQUAL( is_disjoint(section, complement), true );
-
- //JODO: There seems to be no intersection on maps of non set codomain type
- // that can be implemented via &= propagation. Intersectin on those types
- // could be dome elementic defining it via intersection on the set of pairs.
- //if(boost::is_same<T,int>::value)
- //{
- // cout << "left: " << left << endl;
- // cout << "right: " << right << endl;
- // cout << "section: " << section << endl;
- // cout << "complem: " << complement << endl;
- // cout << "all: " << all << endl;
- // cout << "all2: " << all2 << endl;
- //}
-
- //BOOST_CHECK_EQUAL( all.contains(left), true );
- //BOOST_CHECK_EQUAL( all.contains(right), true );
- //BOOST_CHECK_EQUAL( all.contains(complement), true );
-
- //BOOST_CHECK_EQUAL( left.contained_in(all), true );
- //BOOST_CHECK_EQUAL( right.contained_in(all), true );
- //BOOST_CHECK_EQUAL( complement.contained_in(all), true );
- //BOOST_CHECK_EQUAL( section.contained_in(left), true );
- //BOOST_CHECK_EQUAL( section.contained_in(right), true );
 }
 
 
@@ -617,20 +594,14 @@
     // 1
 
     //JODO intersection with key-element not yet working
- //map_A.clear();
- //map_A.add(I0_3D_1).add(I6_9D_1);
- //map_AB = map_A;
- //map_AB &= v1;
- //map_ab.clear();
- //map_ab.add(v1);
-
- //BOOST_CHECK_EQUAL( map_AB, map_ab );
-
- //if(boost::is_same<T,int>::value)
- //{
- // cout << "map_A : " << map_A << endl;
- // cout << "map_AB: " << map_AB << endl;
- //}
+ map_A.clear();
+ map_A.add(I0_3D_1).add(I6_9D_1);
+ map_AB = map_A;
+ map_AB &= v1;
+ map_ab.clear();
+ map_ab.add(mapping_pair<T,U>(v1,u1));
+
+ BOOST_CHECK_EQUAL( map_AB, map_ab );
 }
 
 
@@ -825,81 +796,32 @@
 }
 
 
-template <class T, class U,
- template<class T, class U,
- class Traits = neutron_absorber,
- ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, U),
- ITL_COMBINE Combine = ITL_COMBINE_INSTANCE(itl::inplace_plus, U),
- ITL_SECTION Section = ITL_SECTION_INSTANCE(itl::inplace_star, U),
- template<class,ITL_COMPARE>class Interval = interval,
- ITL_ALLOC Alloc = std::allocator
- >class IntervalMap1,
- template<class T, class U,
+template <template<class T, class U,
                    class Traits = neutron_absorber,
                    ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, U),
                    ITL_COMBINE Combine = ITL_COMBINE_INSTANCE(itl::inplace_plus, U),
                    ITL_SECTION Section = ITL_SECTION_INSTANCE(itl::inplace_star, U),
                    template<class,ITL_COMPARE>class Interval = interval,
                    ITL_ALLOC Alloc = std::allocator
- >class IntervalMap2
- >
-void interval_map_base_laws_plus_4_bicremental_types()
+ >class IntervalMap,
+ class T, class U>
+void interval_map_infix_plus_overload_4_bicremental_types()
 {
- typedef IntervalMap1<T,U> IntervalMap1T;
- typedef IntervalMap2<T,U> IntervalMap2T;
-
- T v0 = make<T>(0);
- T v1 = make<T>(1);
- T v3 = make<T>(3);
- T v5 = make<T>(5);
- T v6 = make<T>(6);
- T v7 = make<T>(7);
- T v8 = make<T>(8);
- T v9 = make<T>(9);
-
- U u1 = make<U>(1);
- U u2 = make<U>(2);
-
- interval<T> I0_1D = interval<T>::rightopen(v0,v1);
- interval<T> I1_3D = interval<T>::rightopen(v1,v3);
- interval<T> I3_6D = interval<T>::rightopen(v3,v6);
- interval<T> I5_7D = interval<T>::rightopen(v5,v7);
- interval<T> I6_8D = interval<T>::rightopen(v6,v8);
- interval<T> I8_9D = interval<T>::rightopen(v8,v9);
-
- typename IntervalMap1T::value_type I0_1D_1(I0_1D, u1);
- typename IntervalMap1T::value_type I1_3D_1(I1_3D, u1);
- typename IntervalMap1T::value_type I3_6D_1(I3_6D, u1);
- typename IntervalMap1T::value_type I5_7D_1(I5_7D, u1);
- typename IntervalMap1T::value_type I6_8D_1(I6_8D, u1);
- typename IntervalMap1T::value_type I8_9D_1(I8_9D, u1);
-
- IntervalMap1T map_a, map_b;
- map_a.add(I3_6D_1).add(I5_7D_1);
- map_b.add(I1_3D_1).add(I8_9D_1);
- map_a = map_a;
- typename IntervalMap1T::value_type val_pair = I8_9D_1;
-
- IntervalMap2T map2_a, map2_b;
- map2_a = map_a;
- map2_a += map_a;
- IntervalMap2T join_map = map_a + map2_a;
- //IntervalMap2T splt_map = map_a + map2_a;
-
- check_commutativity_wrt_plus(map_a, map_b);
- //check_commutativity_plus(map2_a, map_b);
- check_commutativity_wrt_plus(map_a, val_pair);
- typename IntervalMap1T::mapping_pair_type v5_u2(v5,u2);
- check_commutativity_wrt_plus(map_b, v5_u2);
-
- CHECK_ASSOCIATIVITY_WRT(plus)(map_a, map_b, map_a);
- check_associativity_wrt_plus(map_a, map_b, map_a);
-
- check_neutrality_wrt_plus(map_a, neutron<IntervalMap1T>::value());
-
- CHECK_MONOID_WRT(plus)(neutron<IntervalMap1T>::value(), map_a, map_b, map_a);
+ typedef IntervalMap<T,U> IntervalMapT;
+ typename IntervalMapT::interval_mapping_type val_pair1 = IDv(6,9,1);
+ std::pair<const interval<T>, U> val_pair2 = IDv(3,5,3);
+ mapping_pair<T,U> map_pair = K_v(4,3);
+
+ IntervalMapT map_a, map_b;
+ map_a.add(CDv(1,3,1)).add(IDv(8,9,1)).add(IIv(6,11,3));
+ map_b.add(IDv(0,9,2)).add(IIv(3,6,1)).add(IDv(5,7,1));
+
+ BOOST_CHECK_EQUAL(map_a + map_b, map_b + map_a);
+ //This checks all cases of is_interval_map_derivative<T>
+ BOOST_CHECK_EQUAL(map_a + val_pair1, val_pair1 + map_a);
+ BOOST_CHECK_EQUAL(map_b + val_pair2, val_pair2 + map_b);
+ BOOST_CHECK_EQUAL(map_b + map_pair, map_pair + map_b);
 }
 
-
 #endif // __test_itl_interval_map_shared_h_JOFA_080920__
 

Modified: sandbox/itl/libs/itl/test/test_quantifier_map/test_quantifier_map.cpp
==============================================================================
--- sandbox/itl/libs/itl/test/test_quantifier_map/test_quantifier_map.cpp (original)
+++ sandbox/itl/libs/itl/test/test_quantifier_map/test_quantifier_map.cpp 2009-01-21 16:24:25 EST (Wed, 21 Jan 2009)
@@ -14,7 +14,7 @@
 // interval instance types
 #include "../test_type_lists.hpp"
 #include "../test_value_maker.hpp"
-#include "../test_laws.hpp"
+//#include "../test_laws.hpp"
 
 #include <boost/itl/interval_map.hpp>
 #include <boost/itl/split_interval_map.hpp>

Modified: sandbox/itl/libs/itl/test/test_quantifier_map_shared.hpp
==============================================================================
--- sandbox/itl/libs/itl/test/test_quantifier_map_shared.hpp (original)
+++ sandbox/itl/libs/itl/test/test_quantifier_map_shared.hpp 2009-01-21 16:24:25 EST (Wed, 21 Jan 2009)
@@ -29,6 +29,7 @@
>
 void interval_map_base_laws_plus_4_bicremental_types()
 {
+ /*
     typedef IntervalMap1<T,U> IntervalMap1T;
     typedef IntervalMap2<T,U> IntervalMap2T;
 
@@ -73,7 +74,7 @@
         check_commutativity_wrt_plus(map_a, map_b);
         //check_commutativity_plus(map2_a, map_b);
         check_commutativity_wrt_plus(map_a, val_pair);
- typename IntervalMap1T::mapping_pair_type v5_u2(v5,u2);
+ typename IntervalMap1T::domain_mapping_type v5_u2(v5,u2);
         check_commutativity_wrt_plus(map_b, v5_u2);
 
         CHECK_ASSOCIATIVITY_WRT(plus)(map_a, map_b, map_a);
@@ -82,6 +83,7 @@
         check_neutrality_wrt_plus(map_a, neutron<IntervalMap1T>::value());
 
         CHECK_MONOID_WRT(plus)(neutron<IntervalMap1T>::value(), map_a, map_b, map_a);
+ */
 }
 
 
@@ -93,6 +95,7 @@
 const typename JointMapT::value_type& val_pair, const mapping_pair<T,U>& map_pair
 )
 {
+ /*
         //-----------------------------------------------------------------------------
         CHECK_MONOID_WRT(plus)(neutron<JointMapT>::value(), join_map_a, join_map_b, val_pair);
         CHECK_MONOID_WRT(plus)(neutron<JointMapT>::value(), join_map_a, val_pair, join_map_b);
@@ -119,7 +122,7 @@
 
         CHECK_MONOID_WRT_EQUAL(plus)(is_element_equal, neutron<SplitMapT>::value(), split_map_c, join_map_b, val_pair);
         CHECK_MONOID_WRT_EQUAL(plus)(is_element_equal, neutron<SplitMapT>::value(), split_map_c, val_pair, join_map_b);
-
+ */
 }
 
 
@@ -131,6 +134,7 @@
 const typename JointMapT::value_type& val_pair, const mapping_pair<T,U>& map_pair
 )
 {
+ /*
         //-----------------------------------------------------------------------------
         CHECK_MONOID_WRT(et)(neutron<JointMapT>::value(), join_map_a, join_map_b, val_pair);
         CHECK_MONOID_WRT(et)(neutron<JointMapT>::value(), join_map_a, val_pair, join_map_b);
@@ -157,7 +161,7 @@
 
         CHECK_MONOID_WRT_EQUAL(et)(is_element_equal, neutron<SplitMapT>::value(), split_map_c, join_map_b, val_pair);
         CHECK_MONOID_WRT_EQUAL(et)(is_element_equal, neutron<SplitMapT>::value(), split_map_c, val_pair, join_map_b);
-
+ */
 }
 
 template <class T, class U, class Trait>
@@ -176,10 +180,37 @@
         split_map_b.add(IDv(2,3,3)).add(IIv(9,9,3)).add(CDv(9,11,2));
         split_map_c.add(CIv(0,9,2)).add(IIv(3,6,1)).add(CDv(5,7,1));
 
- typename IntervalMapT::value_type val_pair = IDv(6,9,1);
+ typename IntervalMapT::interval_mapping_type val_pair = IDv(6,9,1);
         mapping_pair<T,U> map_pair = K_v(5,1);
 
-
+ IntervalMapT jlhs = join_map_a + join_map_b;
+ IntervalMapT jrhs = join_map_b + join_map_a;
+ BOOST_CHECK_EQUAL(jlhs, jrhs);
+
+ jlhs = join_map_a + val_pair;
+ jrhs = val_pair + join_map_a;
+ BOOST_CHECK_EQUAL(jlhs, jrhs);
+
+ SplitIntervalMapT slhs = split_map_a + split_map_b;
+ SplitIntervalMapT srhs = split_map_b + split_map_a;
+ BOOST_CHECK_EQUAL(slhs, srhs);
+
+ slhs = split_map_a + val_pair;
+ srhs = val_pair + split_map_a;
+ BOOST_CHECK_EQUAL(slhs, srhs);
+
+ jlhs = join_map_a + map_pair;
+ jrhs = map_pair + join_map_a;
+ BOOST_CHECK_EQUAL(jlhs, jrhs);
+
+ slhs = split_map_a + map_pair;
+ srhs = map_pair + split_map_a;
+ BOOST_CHECK_EQUAL(slhs, srhs);
+
+ slhs = split_map_a + join_map_b;
+ srhs = join_map_b + split_map_a;
+ BOOST_CHECK_EQUAL(slhs, srhs);
+ /*
         quantifier_map_check_monoid_instance_plus(
                 join_map_a, join_map_b, join_map_c,
                 split_map_a, split_map_b, split_map_c,
@@ -189,7 +220,7 @@
                 join_map_a, join_map_b, join_map_c,
                 split_map_a, split_map_b, split_map_c,
                 val_pair, map_pair);
-
+ */
         
 }
 

Modified: sandbox/itl/libs/itl/test/test_split_interval_map/test_split_interval_map_shared.cpp
==============================================================================
--- sandbox/itl/libs/itl/test/test_split_interval_map/test_split_interval_map_shared.cpp (original)
+++ sandbox/itl/libs/itl/test/test_split_interval_map/test_split_interval_map_shared.cpp 2009-01-21 16:24:25 EST (Wed, 21 Jan 2009)
@@ -50,3 +50,6 @@
 (test_itl_interval_map_base_is_disjoint_4_bicremental_types, T, bicremental_types)
 { interval_map_base_is_disjoint_4_bicremental_types<split_interval_map, T, int>();}
 
+BOOST_AUTO_TEST_CASE_TEMPLATE
+(test_itl_interval_map_infix_plus_overload_4_bicremental_types, T, bicremental_types)
+{ interval_map_infix_plus_overload_4_bicremental_types<split_interval_map, T, int>();}

Modified: sandbox/itl/libs/itl/test/test_value_maker.hpp
==============================================================================
--- sandbox/itl/libs/itl/test/test_value_maker.hpp (original)
+++ sandbox/itl/libs/itl/test/test_value_maker.hpp 2009-01-21 16:24:25 EST (Wed, 21 Jan 2009)
@@ -80,7 +80,7 @@
         typedef typename ItvMapT::codomain_type codomain_type;
         typedef typename ItvMapT::interval_type interval_type;
         typedef typename ItvMapT::value_type value_type;
- typedef typename ItvMapT::mapping_pair_type mapping_pair_type;
+ typedef typename ItvMapT::domain_mapping_type domain_mapping_type;
 
         static interval<domain_type> interval(int lower, int upper, int bounds = 2)
         {
@@ -94,9 +94,9 @@
                                        test_value<codomain_type>::make(val) );
         }
 
- static mapping_pair_type map_pair(int key, int val)
+ static domain_mapping_type map_pair(int key, int val)
         {
- return mapping_pair_type(test_value<domain_type>::make(key),
+ return domain_mapping_type(test_value<domain_type>::make(key),
                                              test_value<codomain_type>::make(val));
         }
 };


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