|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r50569 - in sandbox/itl: boost/itl libs/itl/doc libs/itl/test/test_itl_interval
From: afojgo_at_[hidden]
Date: 2009-01-13 15:43:47
Author: jofaber
Date: 2009-01-13 15:43:44 EST (Tue, 13 Jan 2009)
New Revision: 50569
URL: http://svn.boost.org/trac/boost/changeset/50569
Log:
Refactored. Completed left_surplus and right_surplus. Stable {msvc-9.0, partly congcc-4.3-a7}
Text files modified:
sandbox/itl/boost/itl/interval.hpp | 189 ++++++++++++++++++---------------------
sandbox/itl/boost/itl/interval_set_algo.hpp | 2
sandbox/itl/boost/itl/interval_sets.hpp | 2
sandbox/itl/boost/itl/map.hpp | 2
sandbox/itl/boost/itl/set.hpp | 2
sandbox/itl/libs/itl/doc/interface.qbk | 131 +++++++++++++++------------
sandbox/itl/libs/itl/doc/itl.qbk | 4
sandbox/itl/libs/itl/test/test_itl_interval/test_itl_interval.cpp | 76 +++++++++++++++
8 files changed, 243 insertions(+), 165 deletions(-)
Modified: sandbox/itl/boost/itl/interval.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval.hpp (original)
+++ sandbox/itl/boost/itl/interval.hpp 2009-01-13 15:43:44 EST (Tue, 13 Jan 2009)
@@ -287,7 +287,7 @@
*/
-/// A class for intervals
+/// A class template for intervals
/** Bounds of the interval may be closed or open.
Discrete or continuous datatypes may be used as domain datatypes DomainT.
@@ -301,8 +301,6 @@
<tt>float, double, Rational etc.</tt> elements. The domain parameter
may be a built in c++ datatype or a class type. It has to implement
the interface DomainT.
-
- @author Joachim Faulhaber
*/
template <class DomainT, ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, DomainT)>
#ifdef USE_CONCEPTS
@@ -312,9 +310,6 @@
{
public:
-/** @name A: Type definitions for the template class
-*/
-//@{
/// Domain type or element type
typedef DomainT domain_type;
/// Compare order on the data
@@ -341,146 +336,133 @@
CLOSED = 0x3,
} ;
-//@}
-
- /// Default constructor; yields an empty interval <tt>[1,0]</tt>
+ /** Default constructor; yields an empty interval <tt>[1,0]</tt> */
interval() : _lwb(unon<DomainT>::value()), _upb(neutron<DomainT>::value()),
_boundtypes(CLOSED) {}
- // Use compiler generated copy contructor
+ //NOTE: Compiler generated copy constructor is used
- /// Constructor for a closed singleton interval <tt>[val,val]</tt>
+ /** Constructor for a closed singleton interval <tt>[val,val]</tt> */
explicit interval(const DomainT& val) :
_lwb(val), _upb(val), _boundtypes(CLOSED) {}
- /// Closed interval <tt>[low,up]</tt>
- interval(const DomainT& low, const DomainT& up) :
- _lwb(low), _upb(up), _boundtypes(CLOSED) {}
- /// Interval from <tt>low</tt> to <tt>up</tt> with bounds <tt>bt</tt>
- interval(const DomainT& low, const DomainT& up, bound_types bt) :
+
+ /** Interval from <tt>low</tt> to <tt>up</tt> with bounds <tt>bt</tt> */
+ interval(const DomainT& low, const DomainT& up, bound_types bt = CLOSED) :
_lwb(low), _upb(up), _boundtypes(bt) {}
+ /** Closed interval <tt>[low,up]</tt> */
static interval closed(const DomainT& low, const DomainT& up)
{ return interval(low, up, CLOSED); }
+ /** Rightopen interval <tt>[low,up)</tt> */
static interval rightopen(const DomainT& low, const DomainT& up)
{ return interval(low, up, RIGHT_OPEN); }
+ /** Leftopen interval <tt>(low,up]</tt> */
static interval leftopen(const DomainT& low, const DomainT& up)
{ return interval(low, up, LEFT_OPEN); }
+ /** Open interval <tt>(low,up)</tt> */
static interval open(const DomainT& low, const DomainT& up)
{ return interval(low, up, OPEN); }
- // Use compiler generated assignment operator =
+ //NOTE: Compiler generated assignment operator = used
-/** @name E: Selectors
-*/
-//@{
- /// Lower bound of the interval
+ /** Lower bound of the interval */
DomainT lower()const { return _lwb; }
- /// Upper bound of the interval
+ /** Upper bound of the interval */
DomainT upper()const { return _upb; }
- /// Typ of interval bounds
+ /** Typ of interval bounds */
bound_types boundtypes()const { return _boundtypes; }
-//@}
-/** @name F.P: Tester, predicates
-*/
-//@{
- /// Is the interval empty?
+ /** Is the interval empty? */
bool empty()const;
- /// Does the interval contain <tt>x</tt>?
+ /** Does the interval contain <tt>x</tt>? */
bool contains(const DomainT& x)const;
- /// Both closed: <tt>[x,y]</tt> ?
+ /** Both closed: <tt>[x,y]</tt> ? */
bool is_closed()const { return _boundtypes == CLOSED; }
- /// Left open right closed: <tt>(x,y]</tt> ?
+ /** Left open right closed: <tt>(x,y]</tt> ? */
bool is_leftopen()const { return _boundtypes == LEFT_OPEN; }
- /// Left closed right open: <tt>[x,y)</tt> ?
+ /** Left closed right open: <tt>[x,y)</tt> ? */
bool is_rightopen()const { return _boundtypes == RIGHT_OPEN; }
- /// Both open: <tt>(x,y)</tt> ?
+ /** Both open: <tt>(x,y)</tt> ? */
bool is_open()const { return _boundtypes == OPEN; }
- /// Left bound is open right unknown <tt>(x,y|</tt> ?
+ /** Left bound is open right unknown <tt>(x,y|</tt> ? */
bool leftbound_open()const { return !leftbound_closed(); }
-
- /// Right bound is open left unknown <tt>|x,y)</tt> ?
+ /** Right bound is open left unknown <tt>|x,y)</tt> ? */
bool rightbound_open()const { return !rightbound_closed(); }
-
- /// Left closed right unknown <tt>[x,y|</tt> ?
+ /** Left closed right unknown <tt>[x,y|</tt> ? */
bool leftbound_closed()const { return 0 != (_boundtypes & RIGHT_OPEN); }
-
- /// Right closed left unknown <tt>|x,y]</tt> ?
+ /** Right closed left unknown <tt>|x,y]</tt> */
bool rightbound_closed()const { return 0 != (_boundtypes & LEFT_OPEN); }
-//@}
-
-/** @name F.R: Tester, relations
-*/
-//@{
- /// <tt>*this</tt> is subset of <tt>super</tt>
+ /** <tt>*this</tt> is subset of <tt>super</tt> */
bool contained_in(const interval& super)const ;
- /// <tt>*this</tt> is superset of <tt>sub</tt>
+ /** <tt>*this</tt> is superset of <tt>sub</tt> */
bool contains(const interval& sub)const;
- /// Equality
+ /** Equality on intervals */
bool equal(const interval& x2)const
{ return (empty() && x2.empty()) || (lower_equal(x2) && upper_equal(x2)); }
- //Equality can also be implemented this way:
- //{ return contained_in(x2) && x2.contained_in(*this); }
- /// <tt>*this</tt> and <tt>x2</tt> are disjoint; their intersection is empty
+ /** <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); }
- /// There is no gap between <tt>*this</tt> and <tt>x2</tt> but they have no element in common
+ /** There is no gap between <tt>*this</tt> and <tt>x2</tt> but they have no element in common */
bool touches(const interval& x2)const;
- /// Exclusive less: maximal element of <tt>*this</tt> is less than the minimal element of <tt>x2</tt>
+ /** 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
+ /** Less on intervals */
bool less(const interval& x2)const
{ return lower_less(x2) || ( lower_equal(x2) && upper_less(x2) ); }
-//@}
-
-
-/** @name G: Modificators
-*/
-//@{
- /// Set the interval empty
+ /** Set the interval empty */
void clear()
{ set_lwb(unon<DomainT>::value()); set_upb(neutron<DomainT>::value()); _boundtypes=CLOSED; }
- /// Set the intervals values
- interval& set(const DomainT& lw, const DomainT& up, bound_types bt)
- { _lwb=lw; _upb=up; _boundtypes=bt; return *this; }
+ /** Set \c *this interval to from \c low to \c up with boundtypes \c bt */
+ interval& set(const DomainT& low, const DomainT& up, bound_types bt)
+ { _lwb=low; _upb=up; _boundtypes=bt; return *this; }
/** Extend <tt>*this</tt> to <tt>x2</tt> yielding an interval from the minimum of lower bounds
to the maximum of upper bounds */
interval& extend(const interval& x2);
-//@}
-
-/** @name H: Combinators and more
-*/
-//@{
- /// Intersection with the interval <tt>x2</tt>; assign result to <tt>isec</tt>
+ /** Intersection with the interval <tt>x2</tt>; assign result to <tt>isec</tt> */
void intersect(interval& isec, const interval& x2)const;
- /// Returns the intersection with the interval <tt>x2</tt>
- interval intersect(const interval& x2)const { interval isec; intersect(isec, x2); return isec; }
+ /** subtract \c x2 from \c *this interval on it's right side. Assign the difference
+ to \c left_over. The result \c left_over is the part of \c *this left of \c x2.
+\code
+left_over = x1 - x2; //on the right side.
+[a ... : x1
+ [b ... : x2; x1.right_subtract(left_over, x2);
+[a b) : left_over
+\endcode
+ */
+ void left_surplus(interval& left_over, const interval& x2)const;
+
+ /** subtract \c x2 from \c *this interval on it's left side. Assign the difference
+ to \c right_over. The result \c right_over is the part of \c *this right of \c x2.
+\code
+right_over = x1 - x2; //on the left.
+... d) : x1
+... c) : x2; x1.left_subtract(right_over, x2);
+ [c d) : right_over
+\endcode
+ */
+ void right_surplus(interval& rsur, const interval& x2)const;
- /// lsur is the part of <tt>*this</tt> that juts out left over <tt>x2</tt>.
- void left_surplus(interval& lsur, const interval& x2)const;
- /// rsur is the part of <tt>*this</tt> that juts out right over <tt>x2</tt>.
- void right_surplus(interval& rsur, const interval& x2)const;
+ interval& left_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.
- */
+ Bordertypes according to the lower bound of *this and the upper bound of rhs. */
interval span(const interval& rhs)const
{
if(empty()) return rhs;
@@ -489,23 +471,12 @@
interval(_lwb, rhs._upb, span(boundtypes(), rhs.boundtypes()));
}
- interval& left_subtract(const interval& x2);
-//@}
-
-
-/** @name S: String representation
- */
-//@{
- /// Interval as string
+
+ /// Interval as string
const std::string as_string()const;
-//@}
- // NOTE ------- DISCRETE ONLY ------- DISCRETE ONLY ------- DISCRETE ONLY -------
-/** @name T: For discrete domain datatypes only that implement operators <tt>++</tt>
- and <tt>--</tt>
- */
-//@{
+
/// First (smallest) element of the interval
DomainT first()const;
/// Last (largest) element of the interval
@@ -560,20 +531,18 @@
/** Sets right border open. */
void open_right_bound();
-//@}
-/** @name U: Utilities and Limits
- */
-//@{
- /// Maximum Interval
+ /// Maximum Interval
static interval always()
{ 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:
bool lower_less(const interval& x2)const;
bool upper_less(const interval& x2)const;
bool lower_less_equal(const interval& x2)const;
@@ -979,7 +948,8 @@
template <class DomainT, ITL_COMPARE Compare>
inline interval<DomainT,Compare>& interval<DomainT,Compare>::left_subtract(const interval& x2)
{
- set_lwb( BoundT(x2._upb, x2.succession_bounds()) );
+ if(!exclusive_less(x2))
+ set_lwb( BoundT(x2._upb, x2.succession_bounds()) );
return *this;
}
@@ -996,8 +966,11 @@
void interval<DomainT,Compare>::left_surplus(interval<DomainT,Compare>& lsur, const interval<DomainT,Compare>& x2)const
{
if(lower_less(x2)) {
- lsur.set_lwb( BoundT(_lwb,boundtypes()) );
- lsur.set_upb( upb_leftOf(x2) );
+ lsur.set_lwb( BoundT(_lwb,boundtypes()) );
+ if(exclusive_less(x2))
+ lsur.set_upb( BoundT(_upb,boundtypes()) );
+ else
+ lsur.set_upb( upb_leftOf(x2) );
}
else lsur.clear();
}
@@ -1006,7 +979,10 @@
void interval<DomainT,Compare>::right_surplus(interval<DomainT,Compare>& rsur, const interval<DomainT,Compare>& x2)const
{
if(x2.upper_less(*this)) {
- rsur.set_lwb(lwb_rightOf(x2));
+ if(exclusive_less(x2))
+ rsur.set_lwb( BoundT(_lwb,boundtypes()) );
+ else
+ rsur.set_lwb(lwb_rightOf(x2));
rsur.set_upb( BoundT(_upb,boundtypes()) );
}
else rsur.clear();
@@ -1166,12 +1142,19 @@
// ----------------------------------------------------------------------------
template <class DomainT, ITL_COMPARE Compare>
itl::interval<DomainT,Compare>& operator &= ( itl::interval<DomainT,Compare>& section,
- const itl::interval<DomainT,Compare>& sectant)
+ const itl::interval<DomainT,Compare>& sectant)
{
section.intersect(section, sectant);
return section;
}
+template <class DomainT, ITL_COMPARE Compare>
+itl::interval<DomainT,Compare> operator & (const itl::interval<DomainT,Compare>& left,
+ const itl::interval<DomainT,Compare>& right)
+{
+ return itl::interval<DomainT,Compare>(left) &= right;
+}
+
template<class CharType, class CharTraits, class DomainT, ITL_COMPARE Compare>
std::basic_ostream<CharType, CharTraits> &operator<<
(std::basic_ostream<CharType, CharTraits> &stream, interval<DomainT,Compare> const& x)
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-13 15:43:44 EST (Tue, 13 Jan 2009)
@@ -79,7 +79,7 @@
_left_end(left_end), _right_end(right_end),
_compare_codomain(false), _result(result_is_equal)
{
- _scope = enclosure(_left).intersect(enclosure(_right));
+ _scope = enclosure(_left) & enclosure(_right);
}
enum{firstboth, nextboth, nextleft, nextright, leftaligned, stop};
Modified: sandbox/itl/boost/itl/interval_sets.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_sets.hpp (original)
+++ sandbox/itl/boost/itl/interval_sets.hpp 2009-01-13 15:43:44 EST (Tue, 13 Jan 2009)
@@ -241,7 +241,7 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-// intersection *=
+// intersection &=
//-----------------------------------------------------------------------------
template
<
Modified: sandbox/itl/boost/itl/map.hpp
==============================================================================
--- sandbox/itl/boost/itl/map.hpp (original)
+++ sandbox/itl/boost/itl/map.hpp 2009-01-13 15:43:44 EST (Tue, 13 Jan 2009)
@@ -298,6 +298,8 @@
different from \c size(). */
size_t iterative_size()const { return size(); }
+ size_t cardinality()const { return size(); }
+
void absorb_neutrons()
{
//content_is_neutron<key_type, data_type> neutron_dropper;
Modified: sandbox/itl/boost/itl/set.hpp
==============================================================================
--- sandbox/itl/boost/itl/set.hpp (original)
+++ sandbox/itl/boost/itl/set.hpp 2009-01-13 15:43:44 EST (Tue, 13 Jan 2009)
@@ -200,6 +200,8 @@
different from \c size(). */
size_t iterative_size()const { return size(); }
+ size_t cardinality()const { return size(); }
+
/** Erase the elements in *this set to which property \c hasProperty applies.
Keep all the rest. */
template<class Predicate>
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-13 15:43:44 EST (Tue, 13 Jan 2009)
@@ -13,9 +13,6 @@
the libraries design and to focus on structural equalities and differences
with the corresponding containers of the standard template library.
-In the table of associated types of interval_sets
-there are types like key_type, value_type and key_compare
-for the __iterative__ aspect.
[section Class templates]
@@ -259,13 +256,13 @@
[[] [] [] [`DefaultConstructible<CodomainT> && EqualityComparable<CodomainT>`] ]
[[] [only `add` used ] [`+=`] [`&& Combinable<CodomainT,Combine>`] ]
[[] [... and also `subtract` used] [`-=`] [`&& Combinable<CodomainT,Inverse<Combine> >`]]
-[[] [`Section` used and `CodomainT` is a set][`*=`] [`&& Intersectable<CodomainT,Section>`] ]
+[[] [`Section` used and `CodomainT` is a set][`&=`] [`&& Intersectable<CodomainT,Section>`] ]
]
The requirements on the type `CodomainT` of associated values for a __itl_map__ or __itv_map__
depend on the usage of their aggregation functionality. If aggregation on overlap
is never used, that is to say that none of the addition, subtraction and intersection
-operations (`+, +=, add`, `-, -=, subtract`, *, *=, add_intersection) are used on the
+operations (`+, +=, add`, `-, -=, subtract`, &, &=, add_intersection) are used on the
__itv_map__, then `CodomainT` only needs to be
[@http://www.generic-programming.org/languages/conceptcpp/issues/concepts-closed.html Regular].
['*Regular*]
@@ -323,16 +320,16 @@
[section Associated Types]
[table Associated types of sets
-[[Aspects] [] [type] [interval] [interval_sets] [itl::set] [std::set]]
-[[__conceptual__] [data] [domain_type] [DomainT] [DomainT] [DomainT] []]
-[[] [ordering][domain_compare] [Compare<DomainT>] [Compare<DomainT>] [Compare<DomainT>][]]
-[[iterative] [data] [interval_type] [] [Interval<DomainT,Compare>] [] []]
-[[] [] [key_type] [] [Interval<DomainT,Compare>] [] [_Key]]
-[[] [] [value_type] [] [Interval<DomainT,Compare>] [] [_Key]]
-[[] [ordering][interval_compare][] [exclusive_less <interval_type>][] []]
-[[] [] [key_compare] [] [exclusive_less <interval_type>][] [_Compare]]
-[[__conceptual__] [size] [size_type] [size<DomainT>::type] [interval_type:: size_type] [std::size_t] []]
-[[] [] [difference_type] [difference <DomainT>::type][interval_type:: difference_type][std::size_t] []]
+[[Aspects] [] [type] [__itv__] [__itv_sets__] [__itl_set__] [`std::set`]]
+[[__conceptual__] [data] [`domain_type`] [`DomainT`] [`DomainT`] [`DomainT`] []]
+[[] [ordering][`domain_compare`] [`Compare<DomainT>`] [`Compare<DomainT>`] [`Compare<DomainT>`][]]
+[[__iterative__] [data] [`interval_type`] [] [`Interval<DomainT,Compare>`] [] []]
+[[] [] [`key_type`] [] [`Interval<DomainT,Compare>`] [] [`_Key`]]
+[[] [] [`value_type`] [] [`Interval<DomainT,Compare>`] [] [`_Key`]]
+[[] [ordering][`interval_compare`][] [`exclusive_less <interval_type>`] [] []]
+[[] [] [`key_compare`] [] [`exclusive_less <interval_type>`] [] [`_Compare`]]
+[[__conceptual__] [size] [`size_type`] [`size<DomainT>::type`] [`interval_type:: size_type`] [`std::size_t`] []]
+[[] [] [`difference_type`] [`difference <DomainT>::type`][`interval_type:: difference_type`][`std::size_t`] []]
]
[endsect][/ Associated Types]
@@ -340,60 +337,76 @@
[section Function Matrix]
[table
-[[Placeholder] [Argument types] [Description]]
+[[Placeholder] [Argument types] [Description]]
+[[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]]
[[[#interval_type] [*i]] [T::interval_type] [the interval type of the container]]
+[[[#itl_set_type] [*s]] [__itl_set__] [itl's set type]]
[[[#interval_set_types] [*S]] [interval_sets] [one of the interval set types]]
[[[#element_mapping_type] [*b]] [T::element_mapping_type] [type of the element mapping of the map]]
[[[#interval_mapping_type][*p]] [T::interval_mapping_type][type of the interval mapping of the map]]
+[[[#itl_map_type] [*m]] [__itl_map__] [itl's map type]]
[[[#interval_map_types] [*M]] [interval_maps] [one of the interval map types]]
]
+[memberref boost::itl::set::iterative_size `iterative_size`]
+
[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()] [1] [1] [1] [1] [1] [1] [1]]
-[[T(const T&)] [A] [1] [1] [1] [1] [1] [1]]
-[[T(const P&)] [ ] [ ] [ ] [ ] [ ] [ ] [ ]]
-[[T& operator=(const T&)] [A] [1] [1] [1] [1] [1] [1]]
-[[void swap(T&)] [ ] [1] [1] [1] [1] [1] [1]]
-[[['*Emptieness, containment*]] [ ] [ ] [ ] [ ] [ ] [ ] [ ]]
-[[void clear()] [E] [1] [1] [1] [1] [1] [1]]
-[[bool empty()const] [1] [1] [1] [1] [1] [1] [1]]
-[[bool contains(const P&)const] [__ei] [__eiS][__eiS __bpM][?__e] [?__b] [ ] [ ]]
-[[bool contained_in(const P&)const] [__e] [__S] [__M] [?__e] [?__p] [ ] [ ]]
-[[['*Size*]] [ ] [ ] [ ] [ ] [ ] [ ] [ ]]
-[[size_type size()const] [1] [1] [1] [1] [1] [1] [1]]
-[[size_type cardinality()const] [1] [1] [1] [?] [?] [ ] [ ]]
-[[difference_type length()const] [1] [1] [1] [ ] [ ] [ ] [ ]]
-[[size_t iterative_size()const] [1] [1] [1] [?] [?] [ ] [ ]]
-[[size_t interval_count()const] [1] [1] [1] [ ] [ ] [ ] [ ]]
-[[['*Range*]] [ ] [ ] [ ] [ ] [ ] [ ] [ ]]
-[[domain_type lower()const] [1] [1] [1] [ ] [ ] [ ] [ ]]
-[[domain_type upper()const] [1] [1] [1] [ ] [ ] [ ] [ ]]
-[[['*Addition*]] [ ] [ ] [ ] [ ] [ ] [ ] [ ]]
-[[T& add<F>(const P&, const F&)] [ ] [ ] [__bp] [ ] [?__b] [ ] [ ]]
-[[T& add(const P&)] [ ] [__ei] [__bp] [__e] [__b] [ ] [ ]]
-[[T& operator+=(T&, const P&)] [ ] [__eiS] [__bpM] [?__eS] [?__bM] [ ] [ ]]
-[[['*Subtraction*]] [ ] [ ] [ ] [ ] [ ] [ ] [ ]]
-[[T& subtract<F>(const P&, const F&)][ ] [ ] [__bp] [ ] [?__b] [ ] [ ]]
-[[T& subtract(const P&)] [ ] [__ei] [__bp] [__e] [__b] [ ] [ ]]
-[[T& operator-=(T&, const P&)] [ ] [__eiS] [__bpM] [?__eS] [?__bM] [ ] [ ]]
-[[['*Insertion, erasure*]] [ ] [ ] [ ] [ ] [ ] [ ] [ ]]
-[[T& insert(const P&)] [ ] [__ei] [__bp] [__e] [__b] [?__e] [?__b]]
-[[T& erase(const P&)] [ ] [__eiS][__eiS __bpM][__e] [__b] [?__e] [?__b]]
-[[['*Intersection*]] [ ] [ ] [ ] [ ] [ ] [ ] [ ]]
-[[void intersect(T&, const P&)const] [__i] [__eiS][__eiS __bpM][ ] [ ] [ ] [ ]]
-[[void add_intersection(T&, const P&)const][][__eiS][__eiS __bpM][ ] [ ] [ ] [ ]]
-[[T& operator&=(T&, const P&)] [__i] [__eiS][__eiS __bpM][?__eS][?__bM] [ ] [ ]]
-[[['*Iterator related*]] [ ] [ ] [ ] [ ] [ ] [ ] [ ]]
-[[J begin()] [ ] [2] [2] [2] [2] [2] [2]]
-[[J end()] [ ] [2] [2] [2] [2] [2] [2]]
-[[J rbegin()] [ ] [2] [2] [2] [2] [2] [2]]
-[[J rend()] [ ] [2] [2] [2] [2] [2] [2]]
-[[J lower_bound(const I&)] [ ] [2] [2] [2] [2] [2] [2]]
-[[J upper_bound(const I&)] [ ] [2] [2] [2] [2] [2] [2]]
+[/ 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][ ] [ ] [ ] [ ]]
+[[`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]]
]
[endsect]
Modified: sandbox/itl/libs/itl/doc/itl.qbk
==============================================================================
--- sandbox/itl/libs/itl/doc/itl.qbk (original)
+++ sandbox/itl/libs/itl/doc/itl.qbk 2009-01-13 15:43:44 EST (Tue, 13 Jan 2009)
@@ -91,14 +91,18 @@
[def __itv_bse_set__ [classref boost::itl::interval_base_set interval_base_set]]
[def __e [link element_type *e*]]
[def __i [link interval_type *i*]]
+[def __s [link itl_set_type *s*]]
[def __S [link interval_set_types *S*]]
[def __b [link element_mapping_type *b*]]
[def __p [link interval_mapping_type *p*]]
+[def __m [link itl_map_type *m*]]
[def __M [link interval_map_types *M*]]
[def __ei [link element_type *e*] [link interval_type *i*]]
[def __bp [link element_mapping_type *b*] [link interval_mapping_type *p*]]
[def __eS [link element_type *e*] [link interval_set_types *S*]]
+[def __es [link element_type *e*] [link itl_set_type *s*]]
[def __bM [link element_mapping_type *b*] [link interval_map_types *M*]]
+[def __bm [link element_mapping_type *b*] [link itl_map_type *m*]]
[def __eiS [link element_type *e*] [link interval_type *i*] [link interval_set_types *S*]]
[def __bpM [link element_mapping_type *b*] [link interval_mapping_type *p*] [link interval_map_types *M*]]
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-13 15:43:44 EST (Tue, 13 Jan 2009)
@@ -225,7 +225,7 @@
}
-BOOST_AUTO_TEST_CASE_TEMPLATE(test_itl_interval_intersect_4_bicremental_types, T, bicremental_types)
+BOOST_AUTO_TEST_CASE_TEMPLATE(test_itl_interval_inplace_intersect_4_bicremental_types, T, bicremental_types)
{
T v0 = make<T>(0);
T v3 = make<T>(3);
@@ -270,3 +270,77 @@
BOOST_CHECK_EQUAL( I3_7D.is_disjoint(I7_9I), true );
BOOST_CHECK_EQUAL( section.empty(), true );
}
+
+BOOST_AUTO_TEST_CASE_TEMPLATE(test_itl_interval_infix_intersect_4_bicremental_types, T, bicremental_types)
+{
+ T v0 = make<T>(0);
+ T v3 = make<T>(3);
+ T v4 = make<T>(4);
+ T v5 = make<T>(5);
+ T v6 = make<T>(6);
+ T v7 = make<T>(7);
+ T v9 = make<T>(9);
+
+ interval<T> section;
+ interval<T> I3_7D = interval<T>::rightopen(v3,v7);
+
+ interval<T> I0_3D = interval<T>::rightopen(v0,v3);
+ section = I3_7D & I0_3D;
+ BOOST_CHECK_EQUAL( I0_3D.is_disjoint(I3_7D), true );
+ BOOST_CHECK_EQUAL( section.empty(), true );
+ BOOST_CHECK_EQUAL( section, interval<T>() );
+
+ interval<T> I0_5D = interval<T>::rightopen(v0,v5);
+ section = I3_7D & I0_5D;
+ BOOST_CHECK_EQUAL( section, interval<T>::rightopen(v3, v5) );
+
+ interval<T> I0_9D = interval<T>::rightopen(v0,v9);
+ section = I3_7D & I0_9D;
+ BOOST_CHECK_EQUAL( section, I3_7D );
+
+ interval<T> I4_5I = interval<T>::closed(v4,v5);
+ section = I3_7D & I4_5I;
+ BOOST_CHECK_EQUAL( section, I4_5I );
+
+ interval<T> C4_6D = interval<T>::open(v4,v6);
+ section = I3_7D & C4_6D;
+ BOOST_CHECK_EQUAL( section, C4_6D );
+
+ interval<T> C4_9I = interval<T>::leftopen(v4,v9);
+ section = I3_7D & C4_9I;
+ BOOST_CHECK_EQUAL( section, interval<T>::open(v4,v7) );
+
+ interval<T> I7_9I = interval<T>::closed(v7,v9);
+ section = I3_7D & I7_9I;
+ BOOST_CHECK_EQUAL( I3_7D.exclusive_less(I7_9I), true );
+ BOOST_CHECK_EQUAL( I3_7D.is_disjoint(I7_9I), true );
+ BOOST_CHECK_EQUAL( section.empty(), true );
+}
+
+BOOST_AUTO_TEST_CASE_TEMPLATE(test_itl_interval_subtract_4_bicremental_types, T, bicremental_types)
+{
+ T v0 = make<T>(0);
+ T v2 = make<T>(2);
+ T v3 = make<T>(3);
+ T v4 = make<T>(4);
+ T v5 = make<T>(5);
+ T v6 = make<T>(6);
+ T v7 = make<T>(7);
+ T v9 = make<T>(9);
+
+ interval<T> diff_1, diff_2;
+ interval<T> I0_3D = interval<T>::rightopen(v0,v3);
+ interval<T> I2_6D = interval<T>::rightopen(v2,v6);
+ interval<T> I4_7D = interval<T>::rightopen(v4,v7);
+ interval<T> I2_4D = interval<T>::rightopen(v2,v4);
+ I2_6D.left_surplus(diff_1,I4_7D);
+ BOOST_CHECK_EQUAL( diff_1, I2_4D );
+ //diff_2 = I2_6D;
+ //diff_2.left_subtract(I4_7D);
+ //BOOST_CHECK_EQUAL( diff_2, I2_4D );
+
+ diff_1.clear();
+ I0_3D.left_surplus(diff_1,I4_7D);
+ BOOST_CHECK_EQUAL( diff_1, I0_3D );
+
+}
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