|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r50599 - in sandbox/itl: boost/itl libs/itl/doc libs/itl/test/test_interval_map_mixed libs/itl/test/test_itl_interval
From: afojgo_at_[hidden]
Date: 2009-01-14 16:03:07
Author: jofaber
Date: 2009-01-14 16:03:05 EST (Wed, 14 Jan 2009)
New Revision: 50599
URL: http://svn.boost.org/trac/boost/changeset/50599
Log:
Added code. Completed operators != > <= >= |= |. Added documentation. Stable {msvc-9.0, partly congcc-4.3-a7}
Text files modified:
sandbox/itl/boost/itl/interval.hpp | 139 ++++++++++++++-------------
sandbox/itl/boost/itl/interval_base_map.hpp | 22 +++
sandbox/itl/boost/itl/interval_base_set.hpp | 22 +++
sandbox/itl/boost/itl/interval_maps.hpp | 200 ++++++++++++++++++++++++++++++++++++++++
sandbox/itl/boost/itl/interval_set_algo.hpp | 7 +
sandbox/itl/boost/itl/map.hpp | 20 +++
sandbox/itl/boost/itl/set.hpp | 20 +++
sandbox/itl/libs/itl/doc/interface.qbk | 113 ++++++++++++----------
sandbox/itl/libs/itl/test/test_interval_map_mixed/test_interval_map_mixed.cpp | 41 ++++++++
sandbox/itl/libs/itl/test/test_itl_interval/test_itl_interval.cpp | 52 ++++++++++
10 files changed, 502 insertions(+), 134 deletions(-)
Modified: sandbox/itl/boost/itl/interval.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval.hpp (original)
+++ sandbox/itl/boost/itl/interval.hpp 2009-01-14 16:03:05 EST (Wed, 14 Jan 2009)
@@ -40,6 +40,7 @@
#include <string>
#include <boost/assert.hpp>
#include <boost/static_assert.hpp>
+#include <boost/next_prior.hpp>
#include <boost/call_traits.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/if.hpp>
@@ -404,10 +405,6 @@
/** <tt>*this</tt> is superset of <tt>sub</tt> */
bool contains(const interval& sub)const;
- /** Equality on intervals */
- bool equal(const interval& x2)const
- { return (empty() && x2.empty()) || (lower_equal(x2) && upper_equal(x2)); }
-
/** <tt>*this</tt> and <tt>x2</tt> are disjoint; their intersection is empty */
bool is_disjoint(const interval& x2)const
{ return exclusive_less(x2) || x2.exclusive_less(*this); }
@@ -417,10 +414,6 @@
/** Maximal element of <tt>*this</tt> is less than the minimal element of <tt>x2</tt> */
bool exclusive_less(const interval& x2)const;
- /** Less on intervals */
- bool less(const interval& x2)const
- { return lower_less(x2) || ( lower_equal(x2) && upper_less(x2) ); }
-
/** Set the interval empty */
void clear()
{ set_lwb(unon<DomainT>::value()); set_upb(neutron<DomainT>::value()); _boundtypes=CLOSED; }
@@ -478,8 +471,8 @@
*/
interval& right_subtract(const interval& x2);
- /** Interval spanning from lower bound of *this interval to the upper bound of rhs.
- Bordertypes according to the lower bound of *this and the upper bound of rhs. */
+ /** Interval spanning from lower bound of \c *this interval to the upper bound of \c rhs.
+ Bordertypes according to the lower bound of \c *this and the upper bound of \c rhs. */
interval span(const interval& rhs)const
{
if(empty()) return rhs;
@@ -489,100 +482,83 @@
}
- /// Interval as string
+ /** Interval as string */
const std::string as_string()const;
- /// First (smallest) element of the interval
+ /** First (smallest) element of the interval */
DomainT first()const;
- /// Last (largest) element of the interval
+ /** Last (largest) element of the interval */
DomainT last()const;
- /// Cardinality of the interval: The number of elements
+ /** Cardinality of the interval: The number of elements */
size_type cardinality()const;
- size_type continuous_cardinality()const
- {
- if(empty())
- return itl::neutron<size_type>::value();
- else if(is_closed() && domain_equal(_lwb, _upb))
- return itl::unon<size_type>::value();
- else
- return std::numeric_limits<size_type>::infinity();
- }
-
- size_type discrete_cardinality()const
- { return empty()? itl::neutron<size_type>::value() : succ(last()-first()); }
-
-
- /// Arithmetic size of the interval
+ /** Arithmetic size of the interval */
difference_type length()const;
- difference_type continuous_length()const
- { return empty() ? itl::neutron<difference_type>::value() : _upb - _lwb; }
-
- difference_type discrete_length()const
- {
- return empty() ?
- itl::neutron<difference_type>::value() :
- succ(last() - first());
- }
-
- /// Size of the interval
+ /** Size of the interval */
size_type size()const { return cardinality(); }
- /// <tt>*this</tt> interval as closed <tt>[x,y]</tt> interval
+ /** <tt>*this</tt> interval as closed <tt>[x,y]</tt> interval. Requires Integral<domain_type>. */
interval as_closed_interval()const;
- /// <tt>*this</tt> interval as open <tt>[x,y]</tt> interval
+
+ /** <tt>*this</tt> interval as open <tt>[x,y]</tt> interval. Requires Integral<domain_type>. */
interval as_rightopen_interval()const;
/** Transforms the interval to the bound-type <tt>bound_types bt</tt> without
- changing it's content
- */
+ changing it's content. Requires Integral<domain_type>. */
void transform_bounds(bound_types bt);
- /** Sets left border closed. */
+ /** Sets left border closed. Requires Integral<domain_type>.*/
void close_left_bound();
- /** Sets right border open. */
+ /** Sets right border open. Requires Integral<domain_type>. */
void open_right_bound();
- /// Maximum Interval
- static interval always()
+ /** An interval that covers the complete range of it's domain_type */
+ static interval whole()
{ return interval<DomainT>::closed(std::numeric_limits<DomainT>::min(),
std::numeric_limits<DomainT>::max()); }
-private:
- void set_lwb(DomainT lw) { _lwb=lw; }
- void set_upb(DomainT up) { _upb=up; }
-
-public:
+ /** First element of \c *this is less than first element of \c x2 */
bool lower_less(const interval& x2)const;
+ /** Last element of \c *this is less than last element of \c x2 */
bool upper_less(const interval& x2)const;
+ /** First element of \c *this is less than or equal to the first element of \c x2 */
bool lower_less_equal(const interval& x2)const;
+ /** Last element of \c *this is less than or equal to the last element of \c x2 */
bool upper_less_equal(const interval& x2)const;
+ /** First element of \c *this is equal to the first element of \c x2 */
bool lower_equal(const interval& x2)const;
+ /** Last element of \c *this is equal to the last element of \c x2 */
bool upper_equal(const interval& x2)const;
public:
typedef typename boost::call_traits<DomainT>::param_type DomainP;
+ /** Less compare of interval elements. */
inline static bool domain_less(DomainP left, DomainP right)
{return domain_compare()(left, right) ;}
+ /** Less or equal compare of interval elements. */
inline static bool domain_less_equal(DomainP left, DomainP right)
{return !domain_compare()(right, left );}
+ /** Equality compare of interval elements. */
inline static bool domain_equal(DomainP left, DomainP right)
{return !domain_compare()(left, right) && !domain_compare()(right, left);}
private:
- // public?
typedef std::pair<DomainT, bound_types> BoundT;
+private:
+ void set_lwb(DomainT lw) { _lwb=lw; }
+ void set_upb(DomainT up) { _upb=up; }
+
void set_lwb_type(bound_types bt)
{ _boundtypes = (unsigned char)((LEFT_OPEN & _boundtypes) | (RIGHT_OPEN & bt)); }
@@ -668,13 +644,23 @@
template<class IntervalT>
struct continuous_interval
{
- static typename IntervalT::size_type
- cardinality(const IntervalT& x)
- { return x.continuous_cardinality(); }
+ static typename IntervalT::size_type cardinality(const IntervalT& x)
+ {
+ typedef typename IntervalT::size_type SizeT;
+ if(x.empty())
+ return itl::neutron<SizeT>::value();
+ else if(x.is_closed() && IntervalT::domain_equal(x.lower(), x.upper()))
+ return itl::unon<SizeT>::value();
+ else
+ return std::numeric_limits<SizeT>::infinity();
+ }
static typename IntervalT::difference_type
length(const IntervalT& x)
- { return x.continuous_length(); }
+ {
+ return x.empty() ? itl::neutron<typename IntervalT::difference_type>::value()
+ : x.upper() - x.lower();
+ }
static bool unaligned_lwb_equal(const IntervalT& x1, const IntervalT& x2)
{ return false; }
@@ -693,11 +679,17 @@
static typename IntervalT::size_type
cardinality(const IntervalT& x)
- { return x.discrete_cardinality(); }
+ {
+ return x.empty()? itl::neutron<typename IntervalT::size_type>::value()
+ : succ(x.last()-x.first());
+ }
- static typename IntervalT::difference_type
- length(const IntervalT& x)
- { return x.discrete_length(); }
+ static typename IntervalT::difference_type length(const IntervalT& x)
+ {
+ return x.empty() ?
+ itl::neutron<typename IntervalT::difference_type>::value() :
+ succ(x.last() - x.first());
+ }
static bool unaligned_lwb_equal(const IntervalT& x1, const IntervalT& x2)
{
@@ -1123,19 +1115,36 @@
}
-
+/** Equality on intervals */
template <class DomainT, ITL_COMPARE Compare>
inline bool operator == (const interval<DomainT,Compare>& lhs, const interval<DomainT,Compare>& rhs)
{
- return lhs.equal(rhs);
+ return (lhs.empty() && rhs.empty()) || (lhs.lower_equal(rhs) && lhs.upper_equal(rhs));
}
template <class DomainT, ITL_COMPARE Compare>
+inline bool operator != (const interval<DomainT,Compare>& lhs, const interval<DomainT,Compare>& rhs)
+{ return !(lhs == rhs); }
+
+/** Strict weak less oredering on intervals */
+template <class DomainT, ITL_COMPARE Compare>
inline bool operator < (const interval<DomainT,Compare>& lhs, const interval<DomainT,Compare>& rhs)
{
- return lhs.less(rhs);
+ if(lhs.empty()) return !rhs.empty();
+ else return lhs.lower_less(rhs) || (lhs.lower_equal(rhs) && lhs.upper_less(rhs));
}
+template <class DomainT, ITL_COMPARE Compare>
+inline bool operator > (const interval<DomainT,Compare>& lhs, const interval<DomainT,Compare>& rhs)
+{ return rhs < lhs; }
+
+template <class DomainT, ITL_COMPARE Compare>
+inline bool operator <= (const interval<DomainT,Compare>& lhs, const interval<DomainT,Compare>& rhs)
+{ return !(lhs > rhs); }
+
+template <class DomainT, ITL_COMPARE Compare>
+inline bool operator >= (const interval<DomainT,Compare>& lhs, const interval<DomainT,Compare>& rhs)
+{ return !(lhs < rhs); }
/// Comparison functor on intervals implementing an overlap free less
/**
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-14 16:03:05 EST (Wed, 14 Jan 2009)
@@ -1268,11 +1268,27 @@
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
>
+inline bool operator > (const interval_base_map<SubType,DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>& lhs,
+ const interval_base_map<SubType,DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>& rhs)
+{ return rhs < lhs; }
+
+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
+>
inline bool operator <= (const interval_base_map<SubType,DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>& lhs,
const interval_base_map<SubType,DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>& rhs)
-{
- return lhs < rhs || lhs == rhs;
-}
+{ return !(lhs > rhs); }
+
+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
+>
+inline bool operator >= (const interval_base_map<SubType,DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>& lhs,
+ const interval_base_map<SubType,DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>& rhs)
+{ return !(lhs < rhs); }
//-----------------------------------------------------------------------------
// min, max
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-14 16:03:05 EST (Wed, 14 Jan 2009)
@@ -604,6 +604,13 @@
template<class SubType,
class DomainT, ITL_COMPARE Compare, template<class,ITL_COMPARE>class Interval, ITL_ALLOC Alloc>
+inline bool operator != (const interval_base_set<SubType,DomainT,Compare,Interval,Alloc>& lhs,
+ const interval_base_set<SubType,DomainT,Compare,Interval,Alloc>& rhs)
+{ return !(lhs == rhs); }
+
+
+template<class SubType,
+ class DomainT, ITL_COMPARE Compare, template<class,ITL_COMPARE>class Interval, ITL_ALLOC Alloc>
inline bool operator < (const interval_base_set<SubType,DomainT,Compare,Interval,Alloc>& lhs,
const interval_base_set<SubType,DomainT,Compare,Interval,Alloc>& rhs)
{
@@ -615,12 +622,21 @@
template<class SubType,
class DomainT, ITL_COMPARE Compare, template<class,ITL_COMPARE>class Interval, ITL_ALLOC Alloc>
+inline bool operator > (const interval_base_set<SubType,DomainT,Compare,Interval,Alloc>& lhs,
+ const interval_base_set<SubType,DomainT,Compare,Interval,Alloc>& rhs)
+{ return rhs < lhs; }
+
+template<class SubType,
+ class DomainT, ITL_COMPARE Compare, template<class,ITL_COMPARE>class Interval, ITL_ALLOC Alloc>
inline bool operator <= (const interval_base_set<SubType,DomainT,Compare,Interval,Alloc>& lhs,
const interval_base_set<SubType,DomainT,Compare,Interval,Alloc>& rhs)
-{
- return lhs < rhs || lhs == rhs;
-}
+{ return !(lhs > rhs); }
+template<class SubType,
+ class DomainT, ITL_COMPARE Compare, template<class,ITL_COMPARE>class Interval, ITL_ALLOC Alloc>
+inline bool operator >= (const interval_base_set<SubType,DomainT,Compare,Interval,Alloc>& lhs,
+ const interval_base_set<SubType,DomainT,Compare,Interval,Alloc>& rhs)
+{ return !(lhs < rhs); }
template<class CharType, class CharTraits,
class SubType, class DomainT,
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-14 16:03:05 EST (Wed, 14 Jan 2009)
@@ -233,6 +233,206 @@
}
//-----------------------------------------------------------------------------
+
+//-----------------------------------------------------------------------------
+// addition |=
+//-----------------------------------------------------------------------------
+template
+<
+ class ObjectT,
+ 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
+>
+ObjectT& operator |=
+(
+ ObjectT& object,
+ const IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>& operand
+)
+{ return object += operand; }
+
+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
+>
+interval_base_map<SubType,DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>
+operator |
+(
+ const 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> ObjectT;
+ return ObjectT(object) += operand;
+}
+//-----------------------------------------------------------------------------
+
+template
+<
+ 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
+>
+IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>&
+operator |=
+(
+ IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>& object,
+ const IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>& operand
+)
+{ return object += operand; }
+
+template
+<
+ 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
+>
+IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>
+operator |
+(
+ const IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>& object,
+ const IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>& operand
+)
+{
+ typedef IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc> ObjectT;
+ return ObjectT(object) += operand;
+}
+//-----------------------------------------------------------------------------
+
+//--- value_type --------------------------------------------------------------
+template
+<
+ 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
+>
+IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>&
+operator |=
+(
+ IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>& object,
+ const typename
+ IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>::value_type& operand
+)
+{
+ return object.add(operand);
+}
+
+template
+<
+ 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
+>
+IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>
+operator |
+(
+ const IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>& object,
+ const typename IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>::value_type& operand
+)
+{
+ typedef IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc> ObjectT;
+ return ObjectT(object) += operand;
+}
+//-----------------------------------------------------------------------------
+
+//--- mapping_type ------------------------------------------------------------
+// Addition (+=) of a base value pair.
+/* Addition of an value pair <tt>x=(I,y)</tt>
+
+ This adds (inserts) a value <tt>y</tt> for an interval <tt>I</tt> into the
+ map, identical member function add.
+
+ If no values are associated already within the range of <tt>I</tt>,
+ <tt>y</tt> will be associated to that interval.
+
+ If there are associated values, in the range of <tt>I</tt>, then all
+ those values within the ranges of their intervals,
+ are incremented by <tt>y</tt>. This is done via operator <tt>+=</tt>
+ which has to be implemented for CodomainT.
+*/
+template
+<
+ 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
+>
+IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>&
+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
+)
+{
+ return object.add(operand);
+}
+
+template
+<
+ 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
+>
+IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>
+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
+)
+{
+ typedef IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc> ObjectT;
+ return ObjectT(object) |= operand;
+}
+//-----------------------------------------------------------------------------
+
+
+
//-----------------------------------------------------------------------------
// subtraction -=
//-----------------------------------------------------------------------------
Modified: sandbox/itl/boost/itl/interval_set_algo.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_set_algo.hpp (original)
+++ sandbox/itl/boost/itl/interval_set_algo.hpp 2009-01-14 16:03:05 EST (Wed, 14 Jan 2009)
@@ -11,6 +11,7 @@
#include <boost/itl/type_traits/is_map.hpp>
#include <boost/itl/notate.hpp>
#include <boost/itl/type_traits/neutron.hpp>
+#include <boost/itl/interval.hpp>
namespace boost{namespace itl
{
@@ -19,12 +20,13 @@
typename IntervalContainerT::size_type continuous_cardinality(const IntervalContainerT& object)
{
typedef typename IntervalContainerT::size_type size_type;
+ typedef typename IntervalContainerT::interval_type interval_type;
size_type size = neutron<size_type>::value();
size_type interval_size;
const_FORALL(typename IntervalContainerT, it, object)
{
- interval_size = IntervalContainerT::key_value(it).continuous_cardinality();
+ interval_size = continuous_interval<interval_type>::cardinality(IntervalContainerT::key_value(it));
if(interval_size == std::numeric_limits<size_type>::infinity())
return interval_size;
else
@@ -37,10 +39,11 @@
typename IntervalContainerT::size_type discrete_cardinality(const IntervalContainerT& object)
{
typedef typename IntervalContainerT::size_type size_type;
+ typedef typename IntervalContainerT::interval_type interval_type;
size_type size = neutron<size_type>::value();
const_FORALL(typename IntervalContainerT, it, object)
- size += IntervalContainerT::key_value(it).discrete_cardinality();
+ size += discrete_interval<interval_type>::cardinality(IntervalContainerT::key_value(it));
return size;
}
Modified: sandbox/itl/boost/itl/map.hpp
==============================================================================
--- sandbox/itl/boost/itl/map.hpp (original)
+++ sandbox/itl/boost/itl/map.hpp 2009-01-14 16:03:05 EST (Wed, 14 Jan 2009)
@@ -332,6 +332,11 @@
return operator==((const base_type&)lhs, (const base_type&)rhs);
}
+ template <typename DomainT, typename CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_ALLOC Alloc>
+ inline bool operator != (const itl::map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc>& lhs,
+ const itl::map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc>& rhs)
+ { return !(lhs == rhs); }
+
//JODO comment...
template <typename DomainT, typename CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_ALLOC Alloc>
inline bool is_element_equal(const itl::map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc>& lhs,
@@ -365,14 +370,21 @@
return operator<((const base_type&)lhs, (const base_type&)rhs);
}
+ template <typename DomainT, typename CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_ALLOC Alloc>
+ inline bool operator > (const itl::map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc>& lhs,
+ const itl::map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc>& rhs)
+ { return rhs < lhs; }
+
/** Partial ordering which is induced by Compare */
template <typename DomainT, typename CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_ALLOC Alloc>
inline bool operator <= (const itl::map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc>& lhs,
const itl::map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc>& rhs)
- {
- typedef std::map<DomainT,CodomainT,ITL_COMPARE_DOMAIN(Compare,DomainT),Alloc<DomainT> > base_type;
- return operator<=((const base_type&)lhs, (const base_type&)rhs);
- }
+ { return !(lhs > rhs); }
+
+ template <typename DomainT, typename CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_ALLOC Alloc>
+ inline bool operator >= (const itl::map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc>& lhs,
+ const itl::map<DomainT,CodomainT,Traits,Compare,Combine,Section,Alloc>& rhs)
+ { return !(lhs < rhs); }
template <typename DomainT, typename CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_ALLOC Alloc>
template <class Combiner>
Modified: sandbox/itl/boost/itl/set.hpp
==============================================================================
--- sandbox/itl/boost/itl/set.hpp (original)
+++ sandbox/itl/boost/itl/set.hpp 2009-01-14 16:03:05 EST (Wed, 14 Jan 2009)
@@ -227,6 +227,11 @@
return operator==((const base_type&)lhs, (const base_type&)rhs);
}
+ template <typename DomainT, ITL_COMPARE Compare, ITL_ALLOC Alloc>
+ inline bool operator != (const itl::set<DomainT,Compare,Alloc>& lhs,
+ const itl::set<DomainT,Compare,Alloc>& rhs)
+ { return !(lhs == rhs); }
+
/** Element equality. Two sets are equal if they contain the same elements */
template <typename DomainT, ITL_COMPARE Compare, ITL_ALLOC Alloc>
inline bool is_element_equal(const itl::set<DomainT,Compare,Alloc>& lhs,
@@ -245,14 +250,21 @@
return operator<((const base_type&)lhs, (const base_type&)rhs);
}
+ template <typename DomainT, ITL_COMPARE Compare, ITL_ALLOC Alloc>
+ inline bool operator > (const itl::set<DomainT,Compare,Alloc>& lhs,
+ const itl::set<DomainT,Compare,Alloc>& rhs)
+ { return rhs < lhs; }
+
/** Partial ordering which is induced by Compare */
template <typename DomainT, ITL_COMPARE Compare, ITL_ALLOC Alloc>
inline bool operator <= (const itl::set<DomainT,Compare,Alloc>& lhs,
const itl::set<DomainT,Compare,Alloc>& rhs)
- {
- typedef std::set<DomainT,ITL_COMPARE_DOMAIN(Compare,DomainT),Alloc<DomainT> > base_type;
- return operator<=((const base_type&)lhs, (const base_type&)rhs);
- }
+ { return !(lhs > rhs); }
+
+ template <typename DomainT, ITL_COMPARE Compare, ITL_ALLOC Alloc>
+ inline bool operator >= (const itl::set<DomainT,Compare,Alloc>& lhs,
+ const itl::set<DomainT,Compare,Alloc>& rhs)
+ { return !(lhs < rhs); }
template <typename DomainT, ITL_COMPARE Compare, ITL_ALLOC Alloc>
Modified: sandbox/itl/libs/itl/doc/interface.qbk
==============================================================================
--- sandbox/itl/libs/itl/doc/interface.qbk (original)
+++ sandbox/itl/libs/itl/doc/interface.qbk 2009-01-14 16:03:05 EST (Wed, 14 Jan 2009)
@@ -338,9 +338,9 @@
[table
[[Placeholder] [Argument types] [Description]]
-[[T ] [] [a container type]]
-[[P ] [] [polymorhical container argument type]]
-[[I,J ] [] [polymorhical iterator type]]
+[[`T` ] [] [a container type]]
+[[`P` ] [] [polymorhical container argument type]]
+[[`I,J` ] [] [polymorhical iterator type]]
[[1,2,... ] [] [number of implementations for this function]]
[[A ] [] [implementation generated by compilers]]
[[[#element_type] [*e]] [T::domain_type] [the element type of the container]]
@@ -357,56 +357,65 @@
[table Itl Interfaces
[[T] [interval][interval\nsets][interval\nmaps][itl::set][itl::map][std::set][std::map]]
-[/ interval itvset itvmap itl:set itl:map std:set std:map]
-[[['*Construct, copy, destruct*]] [ ] [ ] [ ] [ ] [ ] [ ] [ ]]
-[[`T::T()`] [1] [1] [1] [1] [1] [1] [1]]
-[[`T::T(const T&)`] [A] [1] [1] [1] [1] [1] [1]]
-[[`T::T(const P&)`] [ ] [__eiS] [__bpM] [ ] [ ] [ ] [ ]]
-[[`T::T(const P&,...)`] [3] [ ] [ ] [3] [3] [3] [3]]
-[[`T& T::operator=(const T&)`] [A] [1] [1] [1] [1] [1] [1]]
-[[`void T::swap(T&)`] [ ] [1] [1] [1] [1] [1] [1]]
-[[['*Emptieness, containment*]] [ ] [ ] [ ] [ ] [ ] [ ] [ ]]
-[[`void T::clear()`] [1] [1] [1] [1] [1] [1] [1]]
-[[`bool T::empty()const`] [1] [1] [1] [1] [1] [1] [1]]
-[[`bool T::contains(const P&)const`] [__ei] [__eiS][__eiS __bpM][__es] [__bm] [ ] [ ]]
-[[`bool T::contained_in(const P&)const`] [__e] [__S] [__M] [__s] [__m] [ ] [ ]]
-[[['*Size*]] [ ] [ ] [ ] [ ] [ ] [ ] [ ]]
-[[`size_type T::size()const`] [1] [1] [1] [1] [1] [1] [1]]
-[[`size_type T::cardinality()const`] [1] [1] [1] [1] [1] [ ] [ ]]
-[[`difference_type T::length()const`] [1] [1] [1] [ ] [ ] [ ] [ ]]
-[[`size_t T::iterative_size()const`] [1] [1] [1] [1] [1] [ ] [ ]]
-[[`size_t T::interval_count()const`] [1] [1] [1] [ ] [ ] [ ] [ ]]
-[[['*Range*]] [ ] [ ] [ ] [ ] [ ] [ ] [ ]]
-[[`domain_type T::lower()const`] [1] [1] [1] [ ] [ ] [ ] [ ]]
-[[`domain_type T::upper()const`] [1] [1] [1] [ ] [ ] [ ] [ ]]
-[[['*Addition*]] [ ] [ ] [ ] [ ] [ ] [ ] [ ]]
-[[`T& T::add(const P&)`] [ ] [__ei] [__bp] [__e] [__b] [ ] [ ]]
-[[`T& operator +=( T&, const P&)`] [ ] [__eiS] [__bpM] [__es] [__bm] [ ] [ ]]
-[[`T operator + (const T&, const P&)`] [ ] [__eiS] [__bpM] [__es] [__bm] [ ] [JODO test]]
-[[`T& operator |=( T&, const P&)`] [ ] [__eiS] [__bpM] [__es] [__bm] [ ] [JODO test]]
-[[`T operator | (const T&, const P&)`] [ ] [__eiS] [__bpM] [__es] [__bm] [ ] [JODO test]]
-[[['*Subtraction*]] [ ] [ ] [ ] [ ] [ ] [ ] [ ]]
-[[`T& T::subtract(const P&)`] [ ] [__ei] [__bp] [__e] [__b] [ ] [ ]]
-[[`T& operator -=( T&, const P&)`] [ ] [__eiS] [__bpM] [?__eS] [?__bM] [ ] [ ]]
-[[`T operator - (const T&, const P&)`] [ ] [__eiS] [__bpM] [?__eS] [?__bM] [ ] [ ]]
-[[['*Insertion, erasure*]] [ ] [ ] [ ] [ ] [ ] [ ] [ ]]
-[[`T& T::insert(const P&)`] [ ] [__ei] [__bp] [__e] [__b] [?__e] [?__b]]
-[[`T& T::set(const P&)`] [ ] [__ei?] [__bp?] [__e?] [__b?] [?__e?] [JODO]]
-[[`T& T::erase(const P&)`] [ ] [__eiS][__eiS __bpM][__e] [__b] [?__e] [?__b]]
-[[['*Intersection, symmetric difference*]][ ] [ ] [ ] [ ] [ ] [ ] [ ]]
-[[`void T::intersect(T&, const P&)const`] [__i] [__eiS][__eiS __bpM][ ] [ ] [ ] [ ]]
+[/ interval itvset itvmap itl:set itl:map std:set std:map]
+[[['*Construct, copy, destruct*]] [ ] [ ] [ ] [ ] [ ] [ ] [ ]]
+[[`T::T()`] [1] [1] [1] [1] [1] [1] [1]]
+[[`T::T(const T&)`] [A] [1] [1] [1] [1] [1] [1]]
+[[`T::T(const P&)`] [ ] [__eiS] [__bpM] [ ] [ ] [ ] [ ]]
+[[`T::T(const P&,...)`] [3] [ ] [ ] [3] [3] [3] [3]]
+[[`T& T::operator=(const T&)`] [A] [1] [1] [1] [1] [1] [1]]
+[[`void T::swap(T&)`] [ ] [1] [1] [1] [1] [1] [1]]
+[[['*Emptieness, containment*]] [interval][interval\nsets][interval\nmaps][itl::set][itl::map][std::set][std::map]]
+[[`void T::clear()`] [1] [1] [1] [1] [1] [1] [1]]
+[[`bool T::empty()const`] [1] [1] [1] [1] [1] [1] [1]]
+[[`bool T::contains(const P&)const`] [__ei] [__eiS][__eiS __bpM][__es] [__bm] [ ] [ ]]
+[[`bool T::contained_in(const P&)const`] [__e] [__S] [__M] [__s] [__m] [ ] [ ]]
+[[['*Equivalences and Orderings*]][interval][interval\nsets][interval\nmaps][itl::set][itl::map][std::set][std::map]]
+[[`bool operator == (const T&, const T&)`] [1] [1] [1] [1] [1] [1] [1]]
+[[`bool operator != (const T&, const T&)`] [1] [1] [1] [1] [1] [1] [1]]
+[[`bool is_element_equal(const T&, const T&)`] [ ] [1] [1] [1] [1] [ ] [ ]]
+[[`bool is_protonic_equal(const T&, const T&)`][ ] [ ] [1] [ ] [1] [ ] [ ]]
+[[`bool operator < (const T&, const T&)`] [1] [1] [1] [1] [1] [1] [1]]
+[[`bool operator > (const T&, const T&)`] [1] [1] [1] [1] [1] [1] [1]]
+[[`bool operator <= (const T&, const T&)`] [1] [1] [1] [1] [1] [1] [1]]
+[[`bool operator >= (const T&, const T&)`] [1] [1] [1] [1] [1] [1] [1]]
+[[['*Size*]] [interval][interval\nsets][interval\nmaps][itl::set][itl::map][std::set][std::map]]
+[[`size_type T::size()const`] [1] [1] [1] [1] [1] [1] [1]]
+[[`size_type T::cardinality()const`] [1] [1] [1] [1] [1] [ ] [ ]]
+[[`difference_type T::length()const`] [1] [1] [1] [ ] [ ] [ ] [ ]]
+[[`size_t T::iterative_size()const`] [1] [1] [1] [1] [1] [ ] [ ]]
+[[`size_t T::interval_count()const`] [1] [1] [1] [ ] [ ] [ ] [ ]]
+[[['*Range*]] [interval][interval\nsets][interval\nmaps][itl::set][itl::map][std::set][std::map]]
+[[`domain_type T::lower()const`] [1] [1] [1] [ ] [ ] [ ] [ ]]
+[[`domain_type T::upper()const`] [1] [1] [1] [ ] [ ] [ ] [ ]]
+[[['*Addition*]] [interval][interval\nsets][interval\nmaps][itl::set][itl::map][std::set][std::map]]
+[[`T& T::add(const P&)`] [ ] [__ei] [__bp] [__e] [__b] [ ] [ ]]
+[[`T& operator +=( T&, const P&)`] [ ] [__eiS] [__bpM] [__es] [__bm] [ ] [ ]]
+[[`T operator + (const T&, const P&)`] [ ] [__eiS] [__bpM] [__es] [__bm] [ ] [JODO test]]
+[[`T& operator |=( T&, const P&)`] [ ] [__eiS] [__bpM] [__es] [__bm] [ ] [JODO test]]
+[[`T operator | (const T&, const P&)`] [ ] [__eiS] [__bpM] [__es] [__bm] [ ] [JODO test]]
+[[['*Subtraction*]] [ ] [ ] [ ] [ ] [ ] [ ] [ ]]
+[[`T& T::subtract(const P&)`] [ ] [__ei] [__bp] [__e] [__b] [ ] [ ]]
+[[`T& operator -=( T&, const P&)`] [ ] [__eiS] [__bpM] [?__eS] [?__bM] [ ] [ ]]
+[[`T operator - (const T&, const P&)`] [ ] [__eiS] [__bpM] [?__eS] [?__bM] [ ] [ ]]
+[[['*Insertion, erasure*]] [ ] [ ] [ ] [ ] [ ] [ ] [ ]]
+[[`T& T::insert(const P&)`] [ ] [__ei] [__bp] [__e] [__b] [?__e] [?__b]]
+[[`T& T::set(const P&)`] [ ] [__ei?] [__bp?] [__e?] [__b?] [?__e?] [JODO]]
+[[`T& T::erase(const P&)`] [ ] [__eiS][__eiS __bpM][__e] [__b] [?__e] [?__b]]
+[[['*Intersection, symmetric difference*]] [ ] [ ] [ ] [ ] [ ] [ ] [ ]]
+[[`void T::intersect(T&, const P&)const`] [__i] [__eiS][__eiS __bpM][ ] [ ] [ ] [ ]]
[[`void T::add_intersection(T&, const P&)const`][][__eiS][__eiS __bpM][ ] [ ] [ ] [ ]]
-[[`T& operator &=(T&, const P&)`] [__i] [__eiS][__eiS __bpM][?__es][?__bm] [ ] [JODO]]
-[[`T operator & (const T&, const P&)`] [__i] [__eiS][__eiS __bpM][?__es][?__bm] [ ] [JODO]]
-[[`T& operator ^=(T&, const P&)`] [__i] [__eiS][__eiS __bpM][?__es][?__bm] [ ] [JODO]]
-[[`T operator ^ (const T&, const P&)`] [__i] [__eiS][__eiS __bpM][?__es][?__bm] [ ] [JODO]]
-[[['*Iterator related*]] [ ] [ ] [ ] [ ] [ ] [ ] [ ]]
-[[`J T::begin()`] [ ] [2] [2] [2] [2] [2] [2]]
-[[`J T::end()`] [ ] [2] [2] [2] [2] [2] [2]]
-[[`J T::rbegin()`] [ ] [2] [2] [2] [2] [2] [2]]
-[[`J T::rend()`] [ ] [2] [2] [2] [2] [2] [2]]
-[[`J T::lower_bound(const I&)`] [ ] [2] [2] [2] [2] [2] [2]]
-[[`J T::upper_bound(const I&)`] [ ] [2] [2] [2] [2] [2] [2]]
+[[`T& operator &=(T&, const P&)`] [__i] [__eiS][__eiS __bpM][?__es][?__bm] [ ] [JODO]]
+[[`T operator & (const T&, const P&)`] [__i] [__eiS][__eiS __bpM][?__es][?__bm] [ ] [JODO]]
+[[`T& operator ^=(T&, const P&)`] [__i] [__eiS][__eiS __bpM][?__es][?__bm] [ ] [JODO]]
+[[`T operator ^ (const T&, const P&)`] [__i] [__eiS][__eiS __bpM][?__es][?__bm] [ ] [JODO]]
+[[['*Iterator related*]] [ ] [ ] [ ] [ ] [ ] [ ] [ ]]
+[[`J T::begin()`] [ ] [2] [2] [2] [2] [2] [2]]
+[[`J T::end()`] [ ] [2] [2] [2] [2] [2] [2]]
+[[`J T::rbegin()`] [ ] [2] [2] [2] [2] [2] [2]]
+[[`J T::rend()`] [ ] [2] [2] [2] [2] [2] [2]]
+[[`J T::lower_bound(const I&)`] [ ] [2] [2] [2] [2] [2] [2]]
+[[`J T::upper_bound(const I&)`] [ ] [2] [2] [2] [2] [2] [2]]
]
[endsect]
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-14 16:03:05 EST (Wed, 14 Jan 2009)
@@ -255,6 +255,47 @@
BOOST_CHECK_EQUAL( split_map3.iterative_size(), 3 );
}
+BOOST_AUTO_TEST_CASE_TEMPLATE(test_itl_interval_map_mixed_add2_4_bicremental_types, T, bicremental_types)
+{
+ typedef int U;
+ typedef interval_map<T,U> IntervalMapT;
+ typedef split_interval_map<T,U> SplitIntervalMapT;
+ U u1 = make<U>(1);
+
+ T v1 = make<T>(1);
+ T v2 = make<T>(2);
+ T v3 = make<T>(3);
+ T v4 = make<T>(4);
+ T v5 = make<T>(5);
+
+ interval<T> I1_3D = interval<T>::rightopen(v1,v3);
+ interval<T> I2_4D = interval<T>::rightopen(v2,v4);
+ interval<T> I4_5D = interval<T>::rightopen(v4,v5);
+
+ std::pair<interval<T>,U> I1_3D_1(I1_3D, u1);
+ std::pair<interval<T>,U> I2_4D_1(I2_4D, u1);
+ std::pair<interval<T>,U> I4_5D_1(I4_5D, u1);
+ mapping_pair<T,U> v1_1(v1, u1);
+ mapping_pair<T,U> v3_1(v3, u1);
+ mapping_pair<T,U> v5_1(v5, u1);
+
+ SplitIntervalMapT split_map;
+ split_map.add(I1_3D_1).add(I2_4D_1);
+ split_map |= I4_5D_1;
+ BOOST_CHECK_EQUAL( split_map.iterative_size(), 4 );
+ IntervalMapT join_map;
+ join_map |= split_map;
+ BOOST_CHECK_EQUAL( join_map.iterative_size(), 3 );
+
+ IntervalMapT join_map3;
+ join_map3.add(v1_1).add(v3_1);
+ join_map3 |= v5_1;
+ BOOST_CHECK_EQUAL( join_map3.iterative_size(), 3 );
+ SplitIntervalMapT split_map3;
+ split_map3 |= join_map3;
+ BOOST_CHECK_EQUAL( split_map3.iterative_size(), 3 );
+}
+
BOOST_AUTO_TEST_CASE_TEMPLATE(test_itl_interval_map_mixed_subtract_4_bicremental_types, T, bicremental_types)
{
Modified: sandbox/itl/libs/itl/test/test_itl_interval/test_itl_interval.cpp
==============================================================================
--- sandbox/itl/libs/itl/test/test_itl_interval/test_itl_interval.cpp (original)
+++ sandbox/itl/libs/itl/test/test_itl_interval/test_itl_interval.cpp 2009-01-14 16:03:05 EST (Wed, 14 Jan 2009)
@@ -124,7 +124,7 @@
BOOST_AUTO_TEST_CASE(test_itl_interval_ctor_specific)
{
- BOOST_CHECK_EQUAL(interval<double>().continuous_length(), 0.0);
+ BOOST_CHECK_EQUAL(interval<double>().length(), 0.0);
BOOST_CHECK_EQUAL(interval<double>(5.0,5.0).cardinality(), 1);
BOOST_CHECK_EQUAL(interval<std::string>("test","test").cardinality(), 1);
BOOST_CHECK_EQUAL(interval<std::string>("best","test").cardinality(), interval<double>(0.0,0.1).cardinality());
@@ -162,6 +162,50 @@
BOOST_CHECK_EQUAL( C2___8D, C2___8D );
}
+
+BOOST_AUTO_TEST_CASE_TEMPLATE(test_itl_interval_less_4_integral_types, T, integral_types)
+{
+ T v2 = make<T>(2);
+ T v3 = make<T>(3);
+ T v4 = make<T>(4);
+ T v7 = make<T>(7);
+ T v8 = make<T>(8);
+ BOOST_CHECK_EQUAL(interval<T>() < interval<T>(v7,v3), false);
+ BOOST_CHECK_EQUAL(interval<T>::open(v2,v3) < interval<T>::rightopen(v7,v7), false);
+ BOOST_CHECK_EQUAL(interval<T>::leftopen(v3,v3) < interval<T>::closed(v7,v3), false);
+
+ BOOST_CHECK_EQUAL(interval<T>() < interval<T>(v3,v3), true);
+ BOOST_CHECK_EQUAL(interval<T>::open(v2,v3) < interval<T>::rightopen(v7,v8), true);
+
+ //I: (I)nside = closed bound
+ //C: left open bound
+ //D: right open bound
+ interval<T> I3_7I = interval<T>::closed(v3,v7);
+ interval<T> I4_7I = interval<T>::closed(v4,v7);
+
+ interval<T> I3__8D = interval<T>::rightopen(v3,v8);
+ interval<T> C2__7I = interval<T>::leftopen(v2,v7);
+ interval<T> C2___8D = interval<T>::open(v2,v8);
+
+ BOOST_CHECK_EQUAL( I3_7I < I3_7I , false);
+ BOOST_CHECK_EQUAL( I3_7I < I3__8D , false);
+ BOOST_CHECK_EQUAL( I3_7I < C2__7I , false);
+ BOOST_CHECK_EQUAL( I3_7I < C2___8D , false);
+
+ BOOST_CHECK_EQUAL( I3_7I < I4_7I , true);
+
+
+ BOOST_CHECK_EQUAL( I3__8D< I3__8D , false);
+ BOOST_CHECK_EQUAL( I3__8D< C2__7I , false);
+ BOOST_CHECK_EQUAL( I3__8D< C2___8D , false);
+
+ BOOST_CHECK_EQUAL( C2__7I < C2__7I , false);
+ BOOST_CHECK_EQUAL( C2__7I < C2___8D , false);
+
+ BOOST_CHECK_EQUAL( C2___8D< C2___8D , false);
+}
+
+
BOOST_AUTO_TEST_CASE_TEMPLATE(test_itl_interval_equal_4_bicremental_continuous_types, T, bicremental_continuous_types)
{
T v3 = make<T>(3);
@@ -179,13 +223,19 @@
BOOST_CHECK_EQUAL( I3_7I == I3_7D, false );
BOOST_CHECK_EQUAL( I3_7I == C3_7D, false );
BOOST_CHECK_EQUAL( I3_7I == C3_7D, false );
+ BOOST_CHECK_EQUAL( I3_7I != I3_7D, true );
+ BOOST_CHECK_EQUAL( I3_7I != C3_7D, true );
+ BOOST_CHECK_EQUAL( I3_7I != C3_7D, true );
BOOST_CHECK_EQUAL( I3_7D , I3_7D );
BOOST_CHECK_EQUAL( I3_7D == C3_7I, false );
BOOST_CHECK_EQUAL( I3_7D == C3_7D, false );
+ BOOST_CHECK_EQUAL( I3_7D != C3_7I, true );
+ BOOST_CHECK_EQUAL( I3_7D != C3_7D, true );
BOOST_CHECK_EQUAL( C3_7I , C3_7I );
BOOST_CHECK_EQUAL( C3_7I == C3_7D, false );
+ BOOST_CHECK_EQUAL( C3_7I != C3_7D, true );
BOOST_CHECK_EQUAL( C3_7D, C3_7D );
}
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