|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r55381 - in sandbox/itl: boost/itl boost/itl/type_traits libs/itl/doc libs/itl/test/test_casual_
From: afojgo_at_[hidden]
Date: 2009-08-03 05:45:34
Author: jofaber
Date: 2009-08-03 05:45:32 EDT (Mon, 03 Aug 2009)
New Revision: 55381
URL: http://svn.boost.org/trac/boost/changeset/55381
Log:
Refactoring: Changed more enable_if statements to make overload resolution clearer and
to reduce implementations. Removed interval_sets.hpp and interval_maps.hpp.
All global itl functions are now in itl/functions.hpp that does replace itl/operators.hpp.
Stable {msvc-9.0}
Added:
sandbox/itl/boost/itl/functions.hpp (contents, props changed)
Removed:
sandbox/itl/boost/itl/interval_maps.hpp
sandbox/itl/boost/itl/interval_sets.hpp
sandbox/itl/boost/itl/operators.hpp
Text files modified:
sandbox/itl/boost/itl/interval.hpp | 4 --
sandbox/itl/boost/itl/interval_base_map.hpp | 58 +++++++++++++++++++++++++++++++++++----
sandbox/itl/boost/itl/interval_base_set.hpp | 13 ++++++--
sandbox/itl/boost/itl/interval_map.hpp | 1
sandbox/itl/boost/itl/interval_set.hpp | 2
sandbox/itl/boost/itl/set_algo.hpp | 14 ++++++--
sandbox/itl/boost/itl/split_interval_map.hpp | 1
sandbox/itl/boost/itl/type_traits/is_combinable.hpp | 55 ++++++++++++++++++++++++++++++++++++-
sandbox/itl/libs/itl/doc/interface.qbk | 4 +-
sandbox/itl/libs/itl/test/test_casual_/test_casual.cpp | 17 +++++++++++
10 files changed, 144 insertions(+), 25 deletions(-)
Added: sandbox/itl/boost/itl/functions.hpp
==============================================================================
--- (empty file)
+++ sandbox/itl/boost/itl/functions.hpp 2009-08-03 05:45:32 EDT (Mon, 03 Aug 2009)
@@ -0,0 +1,497 @@
+/*-----------------------------------------------------------------------------+
+Copyright (c) 2008-2009: Joachim Faulhaber
++------------------------------------------------------------------------------+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENCE.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
++-----------------------------------------------------------------------------*/
+#ifndef __itl_functions_JOFA_090803_H__
+#define __itl_functions_JOFA_090803_H__
+
+#include <boost/utility/enable_if.hpp>
+#include <boost/itl/type_traits/is_combinable.hpp>
+
+namespace boost{namespace itl
+{
+
+//==============================================================================
+//= Equivalences and Orderings
+//==============================================================================
+/** Returns true, if \c left and \c right contain the same elements.
+ Complexity: linear. */
+template<class LeftT, class RightT>
+typename boost::enable_if<is_intra_combinable<LeftT, RightT>,
+ bool>::type
+is_element_equal(const LeftT& left, const RightT& right)
+{
+ return Interval_Set::is_element_equal(left, right);
+}
+
+/** Returns true, if \c left is lexicographically less than \c right.
+ Intervals are interpreted as sequence of elements.
+ Complexity: linear. */
+template<class LeftT, class RightT>
+typename boost::enable_if<is_intra_combinable<LeftT, RightT>,
+ bool>::type
+is_element_less(const LeftT& left, const RightT& right)
+{
+ return Interval_Set::is_element_less(left, right);
+}
+
+/** Returns true, if \c left is lexicographically greater than \c right.
+ Intervals are interpreted as sequence of elements.
+ Complexity: linear. */
+template<class LeftT, class RightT>
+typename boost::enable_if<is_intra_combinable<LeftT, RightT>,
+ bool>::type
+is_element_greater(const LeftT& left, const RightT& right)
+{
+ return Interval_Set::is_element_greater(left, right);
+}
+
+//==============================================================================
+//= Addition
+//==============================================================================
+/** \par \b Requires: \c OperandT is an interval container addable to \c ObjectT.
+ \b Effects: \c operand is added to \c object.
+ \par \b Returns: A reference to \c object.
+ \b Complexity: loglinear */
+template<class ObjectT, class OperandT>
+typename boost::enable_if<is_intra_combinable<ObjectT, OperandT>,
+ ObjectT>::type&
+operator += (ObjectT& object, const OperandT& operand)
+{
+ typename ObjectT::iterator prior_ = object.end();
+ const_FORALL(typename OperandT, elem_, operand)
+ prior_ = object.add(prior_, *elem_);
+
+ return object;
+}
+
+/** \par \b Requires: \c OperandT is an addable derivative type of \c ObjectT.
+ \b Effects: \c operand is added to \c object.
+ \par \b Returns: A reference to \c object.
+ \b Complexity:
+\code
+ \ OperandT:
+ \ element segment
+ObjectT:
+ interval container O(log n) O(n)
+
+ interval_set amortized
+ spearate_interval_set O(log n)
+
+n = object.interval_count()
+\endcode
+
+For the addition of \b elements, \b segments and \b interval \b containers
+complexity is \b logarithmic and \b linear respectively.
+For \c interval_sets and \c separate_interval_sets addition of segments
+is \b amortized \b logarithmic.
+*/
+template<class ObjectT, class OperandT>
+typename boost::enable_if<is_intra_derivative<ObjectT, OperandT>,
+ ObjectT>::type&
+operator += (ObjectT& object, const OperandT& operand)
+{
+ return object.add(operand);
+}
+
+
+template<class ObjectT, class OperandT>
+typename boost::enable_if<is_binary_intra_combinable<ObjectT, OperandT>, ObjectT>::type
+operator + (ObjectT object, const OperandT& operand)
+{
+ return object += operand;
+}
+
+template<class ObjectT, class OperandT>
+typename boost::enable_if<is_binary_intra_combinable<ObjectT, OperandT>, ObjectT>::type
+operator + (const OperandT& operand, ObjectT object)
+{
+ return object += operand;
+}
+
+
+template<class ObjectT>
+ObjectT operator + (typename ObjectT::overloadable_type object, const ObjectT& operand)
+{
+ return object += operand;
+}
+
+
+//------------------------------------------------------------------------------
+//- Addition |=, |
+//------------------------------------------------------------------------------
+/** \par \b Requires: Types \c ObjectT and \c OperandT are addable.
+ \par \b Effects: \c operand is added to \c object.
+ \par \b Returns: A reference to \c object.
+ \b Complexity:
+\code
+ \ OperandT: interval
+ \ element segment container
+ObjectT:
+ interval container O(log n) O(n) O(m log(n+m))
+
+ interval_set amortized
+ spearate_interval_set O(log n)
+
+n = object.interval_count()
+m = operand.interval_count()
+\endcode
+
+For the addition of \b elements, \b segments and \b interval \b containers
+complexity is \b logarithmic, \b linear and \b loglinear respectively.
+For \c interval_sets and \c separate_interval_sets addition of segments
+is \b amortized \b logarithmic.
+*/
+template<class ObjectT, class OperandT>
+typename boost::enable_if<is_right_intra_combinable<ObjectT, OperandT>,
+ ObjectT>::type&
+operator |= (ObjectT& object, const OperandT& operand)
+{
+ return object += operand;
+}
+
+
+template<class ObjectT, class OperandT>
+typename boost::enable_if<is_binary_intra_combinable<ObjectT, OperandT>, ObjectT>::type
+operator | (ObjectT object, const OperandT& operand)
+{
+ return object += operand;
+}
+
+template<class ObjectT, class OperandT>
+typename boost::enable_if<is_binary_intra_combinable<ObjectT, OperandT>, ObjectT>::type
+operator | (const OperandT& operand, ObjectT object)
+{
+ return object += operand;
+}
+
+
+template<class ObjectT>
+ObjectT operator | (typename ObjectT::overloadable_type object, const ObjectT& operand)
+{
+ return object += operand;
+}
+
+
+//==============================================================================
+//= Subtraction
+//==============================================================================
+//------------------------------------------------------------------------------
+//- Subtraction -=, -
+//------------------------------------------------------------------------------
+/** \par \b Requires: Types \c ObjectT and \c OperandT are subtractable.
+ \par \b Effects: \c operand is subtracted from \c object.
+ \par \b Returns: A reference to \c object.
+ \b Complexity:
+\code
+ \ OperandT: interval
+ \ element segment container
+ObjectT:
+ interval container O(log n) O(n) O(m log(n+m))
+
+ amortized
+ interval_sets O(log n)
+
+n = object.interval_count()
+m = operand.interval_count()
+\endcode
+
+For the subtraction of \em elements, \b segments and \b interval \b containers
+complexity is \b logarithmic, \b linear and \b loglinear respectively.
+For interval sets subtraction of segments
+is \b amortized \b logarithmic.
+*/
+template<class ObjectT, class OperandT>
+inline
+typename boost::enable_if<is_concept_equivalent<is_interval_map, ObjectT, OperandT>,
+ ObjectT>::type&
+operator -=(ObjectT& object, const OperandT& operand)
+{
+ const_FORALL(typename OperandT, elem_, operand)
+ object.subtract(*elem_);
+
+ return object;
+}
+
+template<class ObjectT, class OperandT>
+typename boost::enable_if<is_intra_derivative<ObjectT, OperandT>,
+ ObjectT>::type&
+operator -= (ObjectT& object, const OperandT& operand)
+{
+ return object.subtract(operand);
+}
+
+template<class ObjectT, class OperandT>
+typename boost::enable_if<is_cross_derivative<ObjectT, OperandT>,
+ ObjectT>::type&
+operator -= (ObjectT& object, const OperandT& operand)
+{
+ return object.erase(operand);
+}
+
+template
+<
+ class ObjectT, class SetT, class DomainT, ITL_COMPARE Compare,
+ template<class,ITL_COMPARE>class Interval, ITL_ALLOC Alloc
+>
+inline
+typename boost::enable_if<is_interval_set_companion<ObjectT, SetT>,
+ ObjectT>::type&
+operator -=
+(
+ ObjectT& object,
+ const interval_base_set<SetT,DomainT,Compare,Interval,Alloc>& operand
+)
+{
+ return erase(object, operand);
+}
+
+
+
+template<class ObjectT, class OperandT>
+typename boost::enable_if<is_right_inter_combinable<ObjectT, OperandT>, ObjectT>::type
+operator - (ObjectT object, const OperandT& operand)
+{
+ return object -= operand;
+}
+
+//==============================================================================
+//= Insertion
+//==============================================================================
+template<class ObjectT, class OperandT>
+typename boost::enable_if<is_intra_combinable<ObjectT, OperandT>,
+ ObjectT>::type&
+insert(ObjectT& object, const OperandT& operand)
+{
+ typename ObjectT::iterator prior_ = object.end();
+ const_FORALL(typename OperandT, elem_, operand)
+ object.insert(*elem_);
+
+ return object;
+}
+
+
+//==============================================================================
+//= Erasure
+//==============================================================================
+template
+<
+ class ObjectT, class SetT, class DomainT, ITL_COMPARE Compare,
+ template<class,ITL_COMPARE>class Interval, ITL_ALLOC Alloc
+>
+inline
+typename boost::enable_if<is_interval_set_companion<ObjectT, SetT>,
+ ObjectT>::type&
+erase
+(
+ ObjectT& object,
+ const interval_base_set<SetT,DomainT,Compare,Interval,Alloc>& operand
+)
+{
+ typedef interval_base_set<SetT,DomainT,Compare,Interval,Alloc> operand_type;
+
+ if(operand.empty())
+ return object;
+
+ typename operand_type::const_iterator common_lwb;
+ typename operand_type::const_iterator common_upb;
+
+ if(!Set::common_range(common_lwb, common_upb, operand, object))
+ return object;
+
+ typename operand_type::const_iterator it_ = common_lwb;
+ while(it_ != common_upb)
+ object.erase(*it_++);
+
+ return object;
+}
+
+
+template<class ObjectT, class OperandT>
+typename boost::enable_if<is_interval_map<ObjectT>, ObjectT>::type&
+erase(ObjectT& object, const OperandT& operand)
+{
+ if(operand.empty())
+ return object;
+
+ typename OperandT::const_iterator common_lwb;
+ typename OperandT::const_iterator common_upb;
+
+ if(!Set::common_range(common_lwb, common_upb, operand, object))
+ return object;
+
+ typename OperandT::const_iterator it_ = common_lwb;
+ while(it_ != common_upb)
+ object.erase(*it_++);
+
+ return object;
+}
+
+
+//==============================================================================
+//= Intersection
+//==============================================================================
+//------------------------------------------------------------------------------
+//- Intersection &=, &
+//------------------------------------------------------------------------------
+template<class ObjectT, class OperandT>
+typename boost::enable_if<is_right_inter_combinable<ObjectT, OperandT>, ObjectT>::type&
+operator &= (ObjectT& object, const OperandT& operand)
+{
+ ObjectT intersection;
+ object.add_intersection(intersection, operand);
+ object.swap(intersection);
+ return object;
+}
+
+template<class ObjectT, class OperandT>
+typename boost::enable_if<is_binary_inter_combinable<ObjectT, OperandT>, ObjectT>::type
+operator & (ObjectT object, const OperandT& operand)
+{
+ return object &= operand;
+}
+
+template<class ObjectT, class OperandT>
+typename boost::enable_if<is_binary_inter_combinable<ObjectT, OperandT>, ObjectT>::type
+operator & (const OperandT& operand, ObjectT object)
+{
+ return object &= operand;
+}
+
+template<class ObjectT>
+ObjectT operator & (typename ObjectT::overloadable_type object, const ObjectT& operand)
+{
+ return object &= operand;
+}
+
+//------------------------------------------------------------------------------
+//- intersects
+//------------------------------------------------------------------------------
+template<class LeftT, class RightT>
+typename boost::enable_if<is_inter_combinable<LeftT, RightT>,
+ bool>::type
+intersects(const LeftT& left, const RightT& right)
+{
+ LeftT intersection;
+
+ if(left.empty() || right.empty())
+ false;
+
+ typename RightT::const_iterator right_common_lower_;
+ typename RightT::const_iterator right_common_upper_;
+
+ if(!Set::common_range(right_common_lower_, right_common_upper_, right, left))
+ return false;
+
+ typename RightT::const_iterator it_ = right_common_lower_;
+ while(it_ != right_common_upper_)
+ {
+ left.add_intersection(intersection, RightT::key_value(it_++));
+ if(!intersection.empty())
+ return true;
+ }
+
+ return false;
+}
+
+template<class Type, class AssociateT>
+typename boost::enable_if<is_inter_derivative<Type, AssociateT>,
+ bool>::type
+intersects(const Type& left, const AssociateT& right)
+{
+ return left.intersects(right);
+}
+
+/** \b Returns true, if \c left and \c right have no common elements.
+ Intervals are interpreted as sequence of elements.
+ \b Complexity: loglinear, if \c left and \c right are interval containers. */
+template<class LeftT, class RightT>
+typename boost::enable_if<is_inter_combinable<LeftT, RightT>,
+ bool>::type
+is_disjoint(const LeftT& left, const RightT& right)
+{
+ return !intersects(left, right);
+}
+
+/** \b Returns true, if \c left and \c right have no common elements.
+ Intervals are interpreted as sequence of elements.
+ \b Complexity: logarithmic, if \c AssociateT is an element type \c Type::element_type.
+ linear, if \c AssociateT is a segment type \c Type::segment_type. */
+template<class Type, class AssociateT>
+typename boost::enable_if<is_inter_derivative<Type, AssociateT>,
+ bool>::type
+is_disjoint(const Type& left, const AssociateT& right)
+{
+ return !left.intersects(right);
+}
+
+
+//==============================================================================
+//= Symmetric difference
+//==============================================================================
+//------------------------------------------------------------------------------
+//- Symmetric difference ^=, ^
+//------------------------------------------------------------------------------
+
+
+template<class ObjectT, class OperandT>
+typename boost::enable_if<is_intra_combinable<ObjectT, OperandT>,
+ ObjectT>::type&
+operator ^= (ObjectT& object, const OperandT& operand)
+{
+ return object.flip(operand);
+}
+
+template<class ObjectT, class OperandT>
+typename boost::enable_if<is_intra_derivative<ObjectT, OperandT>,
+ ObjectT>::type&
+operator ^= (ObjectT& object, const OperandT& operand)
+{
+ return object.flip(operand);
+}
+
+template<class ObjectT, class OperandT>
+typename boost::enable_if<is_binary_intra_combinable<ObjectT, OperandT>, ObjectT>::type
+operator ^ (ObjectT object, const OperandT& operand)
+{
+ return object ^= operand;
+}
+
+template<class ObjectT, class OperandT>
+typename boost::enable_if<is_binary_intra_combinable<ObjectT, OperandT>, ObjectT>::type
+operator ^ (const OperandT& operand, ObjectT object)
+{
+ return object ^= operand;
+}
+
+
+template<class ObjectT>
+ObjectT operator ^ (typename ObjectT::overloadable_type object, const ObjectT& operand)
+{
+ return object ^= operand;
+}
+
+
+//-----------------------------------------------------------------------------
+// hull
+//-----------------------------------------------------------------------------
+template<class ObjectT>
+typename boost::enable_if<is_interval_container<ObjectT>,
+ typename ObjectT::interval_type>::type
+hull(const ObjectT& object)
+{
+ return
+ object.empty() ? neutron<typename ObjectT::interval_type>::value()
+ : (ObjectT::key_value(object.begin()))
+ .span(ObjectT::key_value(object.rbegin()));
+}
+
+
+}} // namespace itl boost
+
+#endif
+
+
Modified: sandbox/itl/boost/itl/interval.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval.hpp (original)
+++ sandbox/itl/boost/itl/interval.hpp 2009-08-03 05:45:32 EDT (Mon, 03 Aug 2009)
@@ -9,10 +9,6 @@
#ifndef __itl_interval_JOFA_000626_H__
#define __itl_interval_JOFA_000626_H__
-#ifdef USE_CONCEPTS
-#include <bits/concepts.h>
-#endif
-
#include <ostream>
#include <functional>
#include <limits>
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-08-03 05:45:32 EDT (Mon, 03 Aug 2009)
@@ -13,13 +13,9 @@
#include <boost/itl/detail/notate.hpp>
#include <boost/itl/detail/design_config.hpp>
-#ifdef USE_CONCEPTS
-#include <bits/concepts.h>
-#endif
#include <boost/itl/map.hpp>
#include <boost/itl/interval_base_set.hpp>
-#include <boost/itl/interval_sets.hpp>
#define const_FOR_IMPLMAP(iter) for(typename ImplMapT::const_iterator iter=_map.begin(); (iter)!=_map.end(); (iter)++)
@@ -56,9 +52,6 @@
template<class,ITL_COMPARE>class Interval = itl::interval,
ITL_ALLOC Alloc = std::allocator
>
-#ifdef USE_CONCEPTS
- requires std::LessThanComparable<DomainT>
-#endif
class interval_base_map
{
public:
@@ -509,6 +502,35 @@
)const;
+ /** Returns \c true, if element \c key is found in \c *this map.
+ Complexity: logarithmic. */
+ bool intersects(const domain_type& key)const
+ { return _map.find(interval_type(key)) != _map.end(); }
+
+ /** Returns \c true, if \c inter_val intersects with \c *this map.
+ Complexity: logarithmic. */
+ bool intersects(const interval_type& inter_val)const
+ { return _map.find(inter_val) != _map.end(); }
+
+ /** Returns \c true, if \c key_value_pair is found in \c *this map.
+ Complexity: logarithmic. */
+ bool intersects(const element_type& key_value_pair)const
+ {
+ const_iterator found_ = _map.find(interval_type(key_value_pair.key));
+ return found_ != _map.end() && found_->KEY_VALUE == key_value_pair.data;
+ }
+
+ /** Returns \c true, if \c interval_value_pair intersects with \c *this map:
+ Complexity: logarithmic. */
+ bool intersects(const segment_type& interval_value_pair)const
+ {
+ type intersection;
+ add(intersection, interval_value_pair);
+ return !intersection.empty();
+ }
+
+
+
//==========================================================================
//= Symmetric difference
//==========================================================================
@@ -1221,6 +1243,28 @@
}
+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
+>
+bool is_protonic_equal
+(
+ const IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>& left,
+ const IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>& right
+)
+{
+ return Map::lexicographical_protonic_equal(left, right);
+}
+
+
+
//-----------------------------------------------------------------------------
// order
//-----------------------------------------------------------------------------
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-08-03 05:45:32 EDT (Mon, 03 Aug 2009)
@@ -31,9 +31,6 @@
template<class, ITL_COMPARE>class Interval = itl::interval,
ITL_ALLOC Alloc = std::allocator
>
-#ifdef USE_CONCEPTS
- requires {std::LessThanComparable<DomainT>}
-#endif
class interval_base_set
{
public:
@@ -312,6 +309,16 @@
)const;
+ /** Returns \c true, if element \c key is found in \c *this map.
+ Complexity: logarithmic. */
+ bool intersects(const element_type& key)const
+ { return _map.find(interval_type(key)) != _map.end(); }
+
+ /** Returns \c true, if \c inter_val intersects with \c *this map.
+ Complexity: logarithmic. */
+ bool intersects(const interval_type& inter_val)const
+ { return _map.find(inter_val) != _map.end(); }
+
//==========================================================================
//= Symmetric difference
//==========================================================================
Modified: sandbox/itl/boost/itl/interval_map.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_map.hpp (original)
+++ sandbox/itl/boost/itl/interval_map.hpp 2009-08-03 05:45:32 EDT (Mon, 03 Aug 2009)
@@ -12,7 +12,6 @@
#include <boost/itl/type_traits/is_map.hpp>
#include <boost/itl/interval_set.hpp>
#include <boost/itl/interval_base_map.hpp>
-#include <boost/itl/interval_maps.hpp>
namespace boost{namespace itl
{
Deleted: sandbox/itl/boost/itl/interval_maps.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_maps.hpp 2009-08-03 05:45:32 EDT (Mon, 03 Aug 2009)
+++ (empty file)
@@ -1,420 +0,0 @@
-/*-----------------------------------------------------------------------------+
-Copyright (c) 2008-2009: Joachim Faulhaber
-+------------------------------------------------------------------------------+
- Distributed under the Boost Software License, Version 1.0.
- (See accompanying file LICENCE.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt)
-+-----------------------------------------------------------------------------*/
-#ifndef __itl_interval_maps_hpp_JOFA_081008__
-#define __itl_interval_maps_hpp_JOFA_081008__
-
-#include <boost/itl/interval_base_map.hpp>
-#include <boost/itl/interval_map_algo.hpp>
-#include <boost/itl/operators.hpp>
-
-namespace boost{namespace itl
-{
-
-template
-<
- class, class, class,
- ITL_COMPARE, ITL_COMBINE, ITL_SECTION, template<class,ITL_COMPARE>class, ITL_ALLOC
->
-class interval_map;
-
-
-//==============================================================================
-//= Emptieness, containment
-//==============================================================================
-/*CL
-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,
- class LeftIntervalMap,
- class RightIntervalMap
->
-bool is_contained_in
-(
- const interval_base_map<LeftIntervalMap,DomainT,CodomainT,
- Traits,Compare,Combine,Section,Interval,Alloc>& left,
- const interval_base_map<RightIntervalMap,DomainT,CodomainT,
- Traits,Compare,Combine,Section,Interval,Alloc>& right
-)
-{
- return Interval_Set::is_contained_in(left, right);
-}
-
-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,
- class LeftIntervalMap,
- class RightIntervalMap
->
-bool contains
-(
- const interval_base_map<LeftIntervalMap,DomainT,CodomainT,
- Traits,Compare,Combine,Section,Interval,Alloc>& left,
- const interval_base_map<RightIntervalMap,DomainT,CodomainT,
- Traits,Compare,Combine,Section,Interval,Alloc>& right
-)
-{
- return Interval_Set::contains(left, right);
-}
-*/
-//-----------------------------------------------------------------------------
-// is_disjoint
-//-----------------------------------------------------------------------------
-
-//--- IntervalMap -------------------------------------------------------------
-/** \par \b Returns true, if \c object and \c operand have no common elements (key value pairs).
- Segments are interpreted as sequence of elements (key value pairs).
- \par \b Complexity: loglinear. */
-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,
- class LeftIntervalMap,
- class RightIntervalMap
->
-bool is_disjoint
-(
- interval_base_map<LeftIntervalMap,DomainT,CodomainT,
- Traits,Compare,Combine,Section,Interval,Alloc>& object,
- const interval_base_map<RightIntervalMap,DomainT,CodomainT,
- Traits,Compare,Combine,Section,Interval,Alloc>& operand
-)
-{
- typedef interval_base_map<LeftIntervalMap,DomainT,CodomainT,
- Traits,Compare,Combine,Section,Interval,Alloc> object_type;
- typedef interval_base_map<RightIntervalMap,DomainT,CodomainT,
- Traits,Compare,Combine,Section,Interval,Alloc> operand_type;
- object_type intersection;
-
- if(operand.empty())
- return true;
-
- typename operand_type::const_iterator common_lwb;
- typename operand_type::const_iterator common_upb;
-
- if(!Set::common_range(common_lwb, common_upb, operand, object))
- return true;
-
- typename operand_type::const_iterator it = common_lwb;
- while(it != common_upb)
- {
- object.add_intersection(intersection, (it++)->KEY_VALUE);
- if(!intersection.empty())
- return false;
- }
-
- return true;
-}
-
-//--- IntervalSet -------------------------------------------------------------
-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,
- class IntervalMap,
- class IntervalSet
->
-bool is_disjoint
-(
- const interval_base_map<IntervalMap,DomainT,CodomainT,
- Traits,Compare,Combine,Section,Interval,Alloc>& object,
- const interval_base_set<IntervalSet,DomainT,Compare,Interval,Alloc>& operand
-)
-{
- typedef interval_base_map<IntervalMap,DomainT,CodomainT,
- Traits,Compare,Combine,Section,Interval,Alloc> object_type;
- typedef interval_base_set<IntervalSet,DomainT,Compare,Interval,Alloc> operand_type;
- object_type intersection;
-
- if(operand.empty())
- return true;
-
- typename operand_type::const_iterator common_lwb;
- typename operand_type::const_iterator common_upb;
-
- if(!Set::common_range(common_lwb, common_upb, operand, object))
- return true;
-
- typename operand_type::const_iterator it = common_lwb;
- while(it != common_upb)
- {
- object.add_intersection(intersection, *it++);
- if(!intersection.empty())
- return false;
- }
-
- return true;
-}
-
-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,
- class IntervalMap,
- class IntervalSet
->
-bool is_disjoint
-(
- const interval_base_set<IntervalSet,DomainT,Compare,Interval,Alloc>& left,
- const interval_base_map<IntervalMap,DomainT,CodomainT,
- Traits,Compare,Combine,Section,Interval,Alloc>& right
-)
-{
- return is_disjoint(right, left);
-}
-
-
-//==============================================================================
-//= Equivalences and Orderings
-//==============================================================================
-//------------------------------------------------------------------------------
-// is_element_equal
-//------------------------------------------------------------------------------
-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,
- class LeftIntervalMap,
- class RightIntervalMap
->
-bool is_element_equal
-(
- const interval_base_map<LeftIntervalMap,DomainT,CodomainT,
- Traits,Compare,Combine,Section,Interval,Alloc>& left,
- const interval_base_map<RightIntervalMap,DomainT,CodomainT,
- Traits,Compare,Combine,Section,Interval,Alloc>& right
-)
-{
- return Interval_Set::is_element_equal(left, right);
-}
-
-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,
- class LeftIntervalMap,
- class RightIntervalMap
->
-bool is_element_less
-(
- const interval_base_map<LeftIntervalMap,DomainT,CodomainT,
- Traits,Compare,Combine,Section,Interval,Alloc>& left,
- const interval_base_map<RightIntervalMap,DomainT,CodomainT,
- Traits,Compare,Combine,Section,Interval,Alloc>& right
-)
-{
- return Interval_Set::is_element_less(left, right);
-}
-
-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,
- class LeftIntervalMap,
- class RightIntervalMap
->
-bool is_element_greater
-(
- const interval_base_map<LeftIntervalMap,DomainT,CodomainT,
- Traits,Compare,Combine,Section,Interval,Alloc>& left,
- const interval_base_map<RightIntervalMap,DomainT,CodomainT,
- Traits,Compare,Combine,Section,Interval,Alloc>& right
-)
-{
- return Interval_Set::is_element_greater(left, right);
-}
-
-//------------------------------------------------------------------------------
-// is_inclusion_equal
-//------------------------------------------------------------------------------
-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,
- class LeftIntervalMap,
- class RightIntervalMap
->
-bool is_inclusion_equal
-(
- const interval_base_map<LeftIntervalMap,DomainT,CodomainT,
- Traits,Compare,Combine,Section,Interval,Alloc>& left,
- const interval_base_map<RightIntervalMap,DomainT,CodomainT,
- Traits,Compare,Combine,Section,Interval,Alloc>& right
-)
-{
- return Interval_Set::is_inclusion_equal(left, right);
-}
-
-//-----------------------------------------------------------------------------
-// is_protonic_equal
-//-----------------------------------------------------------------------------
-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
->
-bool is_protonic_equal
-(
- const IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>& left,
- const IntervalMap<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>& right
-)
-{
- return Map::lexicographical_protonic_equal(left, right);
-}
-
-//-----------------------------------------------------------------------------
-// addition +=
-//-----------------------------------------------------------------------------
-template
-<
- class ObjectT,
- 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
-typename boost::enable_if<is_interval_map<ObjectT>,
- ObjectT>::type&
-operator +=
-(
- ObjectT& object,
- const interval_base_map<SubType,DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>& operand
-)
-{
- typedef interval_base_map<SubType,DomainT,CodomainT,
- Traits,Compare,Combine,Section,Interval,Alloc> operand_type;
- typename ObjectT::iterator prior_ = object.end();
- const_FORALL(typename operand_type, elem_, operand)
- prior_ = object.add(prior_, *elem_);
-
- return object;
-}
-
-//-----------------------------------------------------------------------------
-// subtraction -=
-//-----------------------------------------------------------------------------
-template
-<
- class ObjectT,
- 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
-typename boost::enable_if<is_interval_map<ObjectT>,
- ObjectT>::type&
-operator -=
-(
- ObjectT& object,
- const interval_base_map<SubType,DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>& operand
-)
-{
- typedef interval_base_map<SubType,DomainT,CodomainT,
- Traits,Compare,Combine,Section,Interval,Alloc> operand_type;
- const_FORALL(typename operand_type, elem_, operand)
- object.subtract(*elem_);
-
- return object;
-}
-
-//-----------------------------------------------------------------------------
-// symmetric difference ^=
-//-----------------------------------------------------------------------------
-template
-<
- class ObjectT,
- 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
-typename boost::enable_if<is_interval_map<ObjectT>,
- ObjectT>::type&
-operator ^=
-(
- ObjectT& object,
- const interval_base_map<SubType,DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>& operand
-)
-{
- return object.flip(operand);
-}
-
-//-----------------------------------------------------------------------------
-// insert
-//-----------------------------------------------------------------------------
-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,
- class OperandT
->
-interval_base_map<SubType,DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>&
-insert
-(
- interval_base_map<SubType,DomainT,CodomainT,
- Traits,Compare,Combine,Section,Interval,Alloc>& object,
- const OperandT& operand
-)
-{
- const_FORALL(typename OperandT, elem_, operand)
- object.insert(*elem_);
- return object;
-}
-
-//-----------------------------------------------------------------------------
-// erase
-//-----------------------------------------------------------------------------
-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,
- class OperandT
->
-interval_base_map<SubType,DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>&
-erase
-(
- interval_base_map<SubType,DomainT,CodomainT,
- Traits,Compare,Combine,Section,Interval,Alloc>& object,
- const OperandT& operand
-)
-{
- const_FORALL(typename OperandT, elem_, operand)
- object.erase(*elem_);
- return object;
-}
-
-
-
-//-----------------------------------------------------------------------------
-// hull
-//-----------------------------------------------------------------------------
-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
->
-typename interval_base_map<SubType,DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>::interval_type
-hull(const interval_base_map<SubType,DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>& object)
-{
- typedef interval_base_map<SubType,DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc> IntervalMapT;
- typedef typename IntervalMapT::interval_type interval_type;
- return
- object.empty() ? neutron<interval_type>::value()
- : (object.begin()->KEY_VALUE)
- .span(object.rbegin()->KEY_VALUE);
-}
-
-}} // namespace itl boost
-
-#endif
-
-
Modified: sandbox/itl/boost/itl/interval_set.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_set.hpp (original)
+++ sandbox/itl/boost/itl/interval_set.hpp 2009-08-03 05:45:32 EDT (Mon, 03 Aug 2009)
@@ -11,7 +11,7 @@
#include <boost/assert.hpp>
#include <boost/itl/interval_base_set.hpp>
-#include <boost/itl/interval_sets.hpp>
+#include <boost/itl/functions.hpp>
namespace boost{namespace itl
{
Deleted: sandbox/itl/boost/itl/interval_sets.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_sets.hpp 2009-08-03 05:45:32 EDT (Mon, 03 Aug 2009)
+++ (empty file)
@@ -1,243 +0,0 @@
-/*-----------------------------------------------------------------------------+
-Copyright (c) 2008-2009: Joachim Faulhaber
-+------------------------------------------------------------------------------+
- Distributed under the Boost Software License, Version 1.0.
- (See accompanying file LICENCE.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt)
-+-----------------------------------------------------------------------------*/
-#ifndef __itl_interval_sets_hpp_JOFA_080930__
-#define __itl_interval_sets_hpp_JOFA_080930__
-
-#include <boost/itl/interval_base_set.hpp>
-#include <boost/itl/interval_set_algo.hpp>
-#include <boost/itl/operators.hpp>
-
-namespace boost{namespace itl
-{
-
-template<typename, ITL_COMPARE, template<class,ITL_COMPARE>class, ITL_ALLOC>
-class interval_set;
-
-//==============================================================================
-//= Equivalences and Orderings
-//==============================================================================
-//------------------------------------------------------------------------------
-// is_element_equal
-//------------------------------------------------------------------------------
-/** \par \b Returns true, if \c left and \c right contain the same elements.
- \par \b Complexity: linear. */
-template
-<
- class DomainT, ITL_COMPARE Compare, template<class,ITL_COMPARE>class Interval, ITL_ALLOC Alloc,
- class LeftIntervalSet, class RightIntervalSet
->
-inline bool is_element_equal
-(
- const interval_base_set<LeftIntervalSet, DomainT,Compare,Interval,Alloc>& left,
- const interval_base_set<RightIntervalSet,DomainT,Compare,Interval,Alloc>& right
-)
-{
- return Interval_Set::is_element_equal(left, right);
-}
-
-/** \b Returns true, if \c left is lexicographically less than \c right.
- \par Intervals are interpreted as sequence of elements.
- \par \b Complexity: linear. */
-template
-<
- class DomainT, ITL_COMPARE Compare, template<class,ITL_COMPARE>class Interval, ITL_ALLOC Alloc,
- class LeftIntervalSet, class RightIntervalSet
->
-inline bool is_element_less
-(
- const interval_base_set<LeftIntervalSet, DomainT,Compare,Interval,Alloc>& left,
- const interval_base_set<RightIntervalSet,DomainT,Compare,Interval,Alloc>& right
-)
-{
- return Interval_Set::is_element_less(left, right);
-}
-
-/** \b Returns true, if \c left is lexicographically greater than \c right.
- \par Intervals are interpreted as sequence of elements.
- \par \b Complexity: linear. */
-template
-<
- class DomainT, ITL_COMPARE Compare, template<class,ITL_COMPARE>class Interval, ITL_ALLOC Alloc,
- class LeftIntervalSet, class RightIntervalSet
->
-inline bool is_element_greater
-(
- const interval_base_set<LeftIntervalSet, DomainT,Compare,Interval,Alloc>& left,
- const interval_base_set<RightIntervalSet,DomainT,Compare,Interval,Alloc>& right
-)
-{
- return Interval_Set::is_element_greater(left, right);
-}
-
-//==============================================================================
-//= Addition
-//==============================================================================
-/** \par \c operator \c += adds an interval_base_set \c operand to an interval set \c object.
- \par \b Returns: A reference to \c object.
- \par \b Complexity: loglinear. */
-template
-<
- class ObjectT, class SubType,
- class DomainT, ITL_COMPARE Compare,
- template<class,ITL_COMPARE>class Interval, ITL_ALLOC Alloc
->
-inline
-typename boost::enable_if<is_interval_set<ObjectT>,
- ObjectT>::type&
-operator +=
-(
- ObjectT& object,
- const interval_base_set<SubType,DomainT,Compare,Interval,Alloc>& operand
-)
-{
- typedef interval_base_set<SubType,DomainT,Compare,Interval,Alloc> operand_type;
- typename ObjectT::iterator prior_ = object.end();
- const_FORALL(typename operand_type, elem_, operand)
- prior_ = object.add(prior_, *elem_);
-
- return object;
-}
-
-//-----------------------------------------------------------------------------
-// insert
-//-----------------------------------------------------------------------------
-/** Inserts an interval_base_set \c operand to an interval set \c object.
- In the itl \c insert and \c += have the same effect for all \c Sets.
- \par \b Returns: A reference to \c object.
- \par \b Complexity: loglinear. */
-template
-<
- class ObjectT, class SubType,
- class DomainT, ITL_COMPARE Compare,
- template<class,ITL_COMPARE>class Interval, ITL_ALLOC Alloc
->
-inline typename boost::enable_if<is_interval_set<ObjectT>, ObjectT>::type&
-insert
-(
- ObjectT& object,
- const interval_base_set<SubType,DomainT,Compare,Interval,Alloc>& operand
-)
-{
- return object += operand;
-}
-
-
-//==============================================================================
-//= Symmetric difference ^=
-//==============================================================================
-/** \c operator \c ^= symmetrically subtracts an interval_base_set \c operand from an interval set \c object.
- \par \b Returns: A reference to \c object.
- \par \b Complexity: loglinear.
-*/
-template
-<
- class ObjectT, class SubType,
- class DomainT, ITL_COMPARE Compare,
- template<class,ITL_COMPARE>class Interval, ITL_ALLOC Alloc
->
-inline
-typename boost::enable_if<is_interval_set<ObjectT>,
- ObjectT>::type&
-operator ^=
-(
- ObjectT& object,
- const interval_base_set<SubType,DomainT,Compare,Interval,Alloc>& operand
-)
-{
- return object.flip(operand);
-}
-
-//-----------------------------------------------------------------------------
-// is_disjoint
-//-----------------------------------------------------------------------------
-/** \b Returns true, if \c object and \c operand have no common elements.
- Intervals are interpreted as sequence of elements.
- \par \b Complexity: loglinear. */
-template
-<
- class DomainT, ITL_COMPARE Compare, template<class,ITL_COMPARE>class Interval, ITL_ALLOC Alloc,
- class LeftIntervalSet, class RightIntervalSet
->
-bool is_disjoint
-(
- const interval_base_set<LeftIntervalSet, DomainT,Compare,Interval,Alloc>& object,
- const interval_base_set<RightIntervalSet,DomainT,Compare,Interval,Alloc>& operand
-)
-{
- typedef interval_base_set<LeftIntervalSet, DomainT,Compare,Interval,Alloc> object_type;
- typedef interval_base_set<RightIntervalSet,DomainT,Compare,Interval,Alloc> operand_type;
- object_type intersection;
-
- if(operand.empty())
- return true;
-
- typename operand_type::const_iterator common_lwb;
- typename operand_type::const_iterator common_upb;
-
- if(!Set::common_range(common_lwb, common_upb, operand, object))
- return true;
-
- typename operand_type::const_iterator it = common_lwb;
- while(it != common_upb)
- {
- object.add_intersection(intersection, *it++);
- if(!intersection.empty())
- return false;
- }
-
- return true;
-}
-
-//-----------------------------------------------------------------------------
-// erase
-//-----------------------------------------------------------------------------
-/** Erases an interval_base_set \c operand from an interval set \c object.
- In the itl \c erase and \c -= have the same effect for all \c Sets.
- \par \b Returns: A reference to \c object.
- \par \b Complexity: loglinear. */
-template
-<
- class ObjectT, class SubType,
- class DomainT, ITL_COMPARE Compare,
- template<class,ITL_COMPARE>class Interval, ITL_ALLOC Alloc
->
-inline typename boost::enable_if<is_interval_set<ObjectT>, ObjectT>::type&
-erase
-(
- ObjectT& object,
- const interval_base_set<SubType,DomainT,Compare,Interval,Alloc>& operand
-)
-{
- return object -= operand;
-}
-
-
-//-----------------------------------------------------------------------------
-// hull
-//-----------------------------------------------------------------------------
-template
-<
- class SubType, class DomainT,
- ITL_COMPARE Compare, template<class,ITL_COMPARE>class Interval, ITL_ALLOC Alloc
->
-inline typename interval_base_set<SubType,DomainT,Compare,Interval,Alloc>::interval_type
-hull(const interval_base_set<SubType,DomainT,Compare,Interval,Alloc>& object)
-{
- typedef interval_base_set<SubType,DomainT,Compare,Interval,Alloc> IntervalSetT;
- typedef typename IntervalSetT::interval_type interval_type;
- return
- object.empty() ? neutron<interval_type>::value()
- : (*object.begin()).span(*object.rbegin());
-}
-
-
-}} // namespace itl boost
-
-#endif
-
-
Deleted: sandbox/itl/boost/itl/operators.hpp
==============================================================================
--- sandbox/itl/boost/itl/operators.hpp 2009-08-03 05:45:32 EDT (Mon, 03 Aug 2009)
+++ (empty file)
@@ -1,288 +0,0 @@
-/*-----------------------------------------------------------------------------+
-Copyright (c) 2008-2009: Joachim Faulhaber
-+------------------------------------------------------------------------------+
- Distributed under the Boost Software License, Version 1.0.
- (See accompanying file LICENCE.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt)
-+-----------------------------------------------------------------------------*/
-#ifndef __itl_operators_JOFA_090115_H__
-#define __itl_operators_JOFA_090115_H__
-
-#include <boost/utility/enable_if.hpp>
-#include <boost/itl/type_traits/is_combinable.hpp>
-
-namespace boost{namespace itl
-{
-
-//==============================================================================
-//= Addition
-//==============================================================================
-/** \par \b Requires: \c OperandT is an addable derivative type of \c ObjectT.
- \b Effects: \c operand is added to \c object.
- \par \b Returns: A reference to \c object.
- \b Complexity:
-\code
- \ OperandT:
- \ element segment
-ObjectT:
- interval container O(log n) O(n)
-
- interval_set amortized
- spearate_interval_set O(log n)
-
-n = object.interval_count()
-\endcode
-
-For the addition of \b elements, \b segments and \b interval \b containers
-complexity is \b logarithmic and \b linear respectively.
-For \c interval_sets and \c separate_interval_sets addition of segments
-is \b amortized \b logarithmic.
-*/
-template<class ObjectT, class OperandT>
-typename boost::enable_if<is_intra_derivative<ObjectT, OperandT>,
- ObjectT>::type&
-operator += (ObjectT& object, const OperandT& operand)
-{
- return object.add(operand);
-}
-
-
-template<class ObjectT, class OperandT>
-typename boost::enable_if<is_binary_intra_combinable<ObjectT, OperandT>, ObjectT>::type
-operator + (ObjectT object, const OperandT& operand)
-{
- return object += operand;
-}
-
-template<class ObjectT, class OperandT>
-typename boost::enable_if<is_binary_intra_combinable<ObjectT, OperandT>, ObjectT>::type
-operator + (const OperandT& operand, ObjectT object)
-{
- return object += operand;
-}
-
-
-template<class ObjectT>
-ObjectT operator + (typename ObjectT::overloadable_type object, const ObjectT& operand)
-{
- return object += operand;
-}
-
-
-//------------------------------------------------------------------------------
-//- Addition |=, |
-//------------------------------------------------------------------------------
-/** \par \b Requires: Types \c ObjectT and \c OperandT are addable.
- \par \b Effects: \c operand is added to \c object.
- \par \b Returns: A reference to \c object.
- \b Complexity:
-\code
- \ OperandT: interval
- \ element segment container
-ObjectT:
- interval container O(log n) O(n) O(m log(n+m))
-
- interval_set amortized
- spearate_interval_set O(log n)
-
-n = object.interval_count()
-m = operand.interval_count()
-\endcode
-
-For the addition of \b elements, \b segments and \b interval \b containers
-complexity is \b logarithmic, \b linear and \b loglinear respectively.
-For \c interval_sets and \c separate_interval_sets addition of segments
-is \b amortized \b logarithmic.
-*/
-template<class ObjectT, class OperandT>
-typename boost::enable_if<is_right_intra_combinable<ObjectT, OperandT>,
- ObjectT>::type&
-operator |= (ObjectT& object, const OperandT& operand)
-{ return object += operand; }
-
-
-template<class ObjectT, class OperandT>
-typename boost::enable_if<is_binary_intra_combinable<ObjectT, OperandT>, ObjectT>::type
-operator | (ObjectT object, const OperandT& operand)
-{
- return object += operand;
-}
-
-template<class ObjectT, class OperandT>
-typename boost::enable_if<is_binary_intra_combinable<ObjectT, OperandT>, ObjectT>::type
-operator | (const OperandT& operand, ObjectT object)
-{
- return object += operand;
-}
-
-
-template<class ObjectT>
-ObjectT operator | (typename ObjectT::overloadable_type object, const ObjectT& operand)
-{
- return object += operand;
-}
-
-
-//==============================================================================
-//= Subtraction
-//==============================================================================
-//------------------------------------------------------------------------------
-//- Subtraction -=, -
-//------------------------------------------------------------------------------
-/** \par \b Requires: Types \c ObjectT and \c OperandT are subtractable.
- \par \b Effects: \c operand is subtracted from \c object.
- \par \b Returns: A reference to \c object.
- \b Complexity:
-\code
- \ OperandT: interval
- \ element segment container
-ObjectT:
- interval container O(log n) O(n) O(m log(n+m))
-
- amortized
- interval_sets O(log n)
-
-n = object.interval_count()
-m = operand.interval_count()
-\endcode
-
-For the subtraction of \em elements, \b segments and \b interval \b containers
-complexity is \b logarithmic, \b linear and \b loglinear respectively.
-For interval sets subtraction of segments
-is \b amortized \b logarithmic.
-*/
-template<class ObjectT, class OperandT>
-typename boost::enable_if<is_intra_derivative<ObjectT, OperandT>,
- ObjectT>::type&
-operator -= (ObjectT& object, const OperandT& operand)
-{
- return object.subtract(operand);
-}
-
-template<class ObjectT, class OperandT>
-typename boost::enable_if<is_cross_derivative<ObjectT, OperandT>,
- ObjectT>::type&
-operator -= (ObjectT& object, const OperandT& operand)
-{
- return object.erase(operand);
-}
-
-template
-<
- class ObjectT, class SetT, class DomainT, ITL_COMPARE Compare,
- template<class,ITL_COMPARE>class Interval, ITL_ALLOC Alloc
->
-inline
-typename boost::enable_if<is_interval_set_companion<ObjectT, SetT>,
- ObjectT>::type&
-operator -=
-(
- ObjectT& object,
- const interval_base_set<SetT,DomainT,Compare,Interval,Alloc>& operand
-)
-{
- typedef interval_base_set<SetT,DomainT,Compare,Interval,Alloc> operand_type;
-
- if(operand.empty())
- return object;
-
- typename operand_type::const_iterator common_lwb;
- typename operand_type::const_iterator common_upb;
-
- if(!Set::common_range(common_lwb, common_upb, operand, object))
- return object;
-
- typename operand_type::const_iterator it_ = common_lwb;
- while(it_ != common_upb)
- object.erase(*it_++);
-
- return object;
-}
-
-
-
-template<class ObjectT, class OperandT>
-typename boost::enable_if<is_right_inter_combinable<ObjectT, OperandT>, ObjectT>::type
-operator - (ObjectT object, const OperandT& operand)
-{
- return object -= operand;
-}
-
-//==============================================================================
-//= Intersection
-//==============================================================================
-//------------------------------------------------------------------------------
-//- Intersection &=, &
-//------------------------------------------------------------------------------
-template<class ObjectT, class OperandT>
-typename boost::enable_if<is_right_inter_combinable<ObjectT, OperandT>, ObjectT>::type&
-operator &= (ObjectT& object, const OperandT& operand)
-{
- ObjectT intersection;
- object.add_intersection(intersection, operand);
- object.swap(intersection);
- return object;
-}
-
-template<class ObjectT, class OperandT>
-typename boost::enable_if<is_binary_inter_combinable<ObjectT, OperandT>, ObjectT>::type
-operator & (ObjectT object, const OperandT& operand)
-{
- return object &= operand;
-}
-
-template<class ObjectT, class OperandT>
-typename boost::enable_if<is_binary_inter_combinable<ObjectT, OperandT>, ObjectT>::type
-operator & (const OperandT& operand, ObjectT object)
-{
- return object &= operand;
-}
-
-template<class ObjectT>
-ObjectT operator & (typename ObjectT::overloadable_type object, const ObjectT& operand)
-{
- return object &= operand;
-}
-
-
-//==============================================================================
-//= Symmetric difference
-//==============================================================================
-//------------------------------------------------------------------------------
-//- Symmetric difference ^=, ^
-//------------------------------------------------------------------------------
-template<class ObjectT, class OperandT>
-typename boost::enable_if<is_intra_derivative<ObjectT, OperandT>,
- ObjectT>::type&
-operator ^= (ObjectT& object, const OperandT& operand)
-{
- return object.flip(operand);
-}
-
-template<class ObjectT, class OperandT>
-typename boost::enable_if<is_binary_intra_combinable<ObjectT, OperandT>, ObjectT>::type
-operator ^ (ObjectT object, const OperandT& operand)
-{
- return object ^= operand;
-}
-
-template<class ObjectT, class OperandT>
-typename boost::enable_if<is_binary_intra_combinable<ObjectT, OperandT>, ObjectT>::type
-operator ^ (const OperandT& operand, ObjectT object)
-{
- return object ^= operand;
-}
-
-
-template<class ObjectT>
-ObjectT operator ^ (typename ObjectT::overloadable_type object, const ObjectT& operand)
-{
- return object ^= operand;
-}
-
-
-}} // namespace itl boost
-
-#endif
-
-
Modified: sandbox/itl/boost/itl/set_algo.hpp
==============================================================================
--- sandbox/itl/boost/itl/set_algo.hpp (original)
+++ sandbox/itl/boost/itl/set_algo.hpp 2009-08-03 05:45:32 EDT (Mon, 03 Aug 2009)
@@ -136,13 +136,13 @@
}
template<class SetType>
- bool is_disjoint(const SetType& left, const SetType& right)
+ bool intersects(const SetType& left, const SetType& right)
{
typename SetType::const_iterator common_lwb_right_;
typename SetType::const_iterator common_upb_right_;
if(!common_range(common_lwb_right_, common_upb_right_, right, left))
- return true;
+ return false;
typename SetType::const_iterator right_ = common_lwb_right_, found_;
@@ -150,10 +150,16 @@
{
found_ = left.find(*right_++);
if(found_ != left.end())
- return false; // found a common element
+ return true; // found a common element
}
// found no common element
- return true;
+ return false;
+ }
+
+ template<class SetType>
+ inline bool is_disjoint(const SetType& left, const SetType& right)
+ {
+ return !intersects(left, right);
}
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-08-03 05:45:32 EDT (Mon, 03 Aug 2009)
@@ -12,7 +12,6 @@
#include <boost/itl/interval_set.hpp>
#include <boost/itl/interval_map.hpp>
#include <boost/itl/interval_base_map.hpp>
-#include <boost/itl/interval_maps.hpp>
#include <boost/itl/split_interval_set.hpp>
namespace boost{namespace itl
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-08-03 05:45:32 EDT (Mon, 03 Aug 2009)
@@ -42,6 +42,42 @@
is_interval_container<Type>::value && !is_interval_map<Type>::value;
};
+template<template<class>class IsConcept, class LeftT, class RightT>
+struct is_concept_equivalent
+{
+ typedef is_concept_equivalent<IsConcept, LeftT, RightT> type;
+ static const bool value =
+ mpl::and_<IsConcept<LeftT>, IsConcept<RightT> >::value;
+};
+
+template<class LeftT, class RightT>
+struct is_intra_combinable
+{
+ typedef is_intra_combinable<LeftT, RightT> type;
+ static const bool value =
+ mpl::or_<is_concept_equivalent<is_interval_set, LeftT, RightT>,
+ is_concept_equivalent<is_interval_map, LeftT, RightT> >::value;
+};
+
+template<class LeftT, class RightT>
+struct is_cross_combinable
+{
+ typedef is_cross_combinable<LeftT, RightT> type;
+ static const bool value =
+ mpl::or_<
+ mpl::and_<is_interval_map<LeftT>, is_interval_set<RightT> >
+ , mpl::and_<is_interval_set<LeftT>, is_interval_map<RightT> >
+ >::value;
+};
+
+template<class LeftT, class RightT>
+struct is_inter_combinable
+{
+ typedef is_inter_combinable<LeftT, RightT> type;
+ static const bool value =
+ mpl::or_<is_intra_combinable<LeftT,RightT>, is_cross_combinable<LeftT,RightT> >::value;
+};
+
//------------------------------------------------------------------------------
// is_interval_set_derivative
//------------------------------------------------------------------------------
@@ -124,9 +160,24 @@
struct is_cross_derivative
{
typedef is_cross_derivative<Type, AssociateT> type;
+ static const bool value =
+ mpl::and_
+ <
+ is_interval_map<Type>
+ , is_interval_set_derivative<Type, AssociateT>
+ >::value;
+};
+
+template<class Type, class AssociateT>
+struct is_inter_derivative
+{
+ typedef is_inter_derivative<Type, AssociateT> type;
static const bool value =
- ( is_interval_map<Type>::value
- && is_interval_set_derivative<Type, AssociateT>::value);
+ mpl::or_
+ <
+ is_intra_derivative<Type, AssociateT>
+ , is_cross_derivative<Type, AssociateT>
+ >::value;
};
Modified: sandbox/itl/libs/itl/doc/interface.qbk
==============================================================================
--- sandbox/itl/libs/itl/doc/interface.qbk (original)
+++ sandbox/itl/libs/itl/doc/interface.qbk 2009-08-03 05:45:32 EDT (Mon, 03 Aug 2009)
@@ -448,8 +448,8 @@
[[['*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 P&)`] [ ] [__S] [__M] [1] [1] [ ] [ ]]
-[[`bool is_protonic_equal(const T&, const T&)`][ ] [ ] [__M] [ ] [1] [ ] [ ]]
+[[`bool is_element_equal(const P&, const P&)`] [ ] [__S] [__M] [1] [1] [ ] [ ]]
+[[`bool is_protonic_equal(const P&, const P&)`][ ] [ ] [__M] [ ] [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]]
Modified: sandbox/itl/libs/itl/test/test_casual_/test_casual.cpp
==============================================================================
--- sandbox/itl/libs/itl/test/test_casual_/test_casual.cpp (original)
+++ sandbox/itl/libs/itl/test/test_casual_/test_casual.cpp 2009-08-03 05:45:32 EDT (Mon, 03 Aug 2009)
@@ -195,7 +195,24 @@
check_combinable<is_interval_set_companion, sM, zS>(true, "sM_zS");
check_combinable<is_interval_set_companion, sM, sS>(true, "sM_sS");
+ //--------------------------------------------------------------------------
+ check_combinable<is_intra_combinable, jS, jS>(true, "jS_jS");
+ check_combinable<is_intra_combinable, zS, jS>(true, "zS_jS");
+ check_combinable<is_intra_combinable, sS, jS>(true, "sS_jS");
+
+ check_combinable<is_intra_combinable, jS, zS>(true, "jS_zS");
+ check_combinable<is_intra_combinable, zS, zS>(true, "zS_zS");
+ check_combinable<is_intra_combinable, sS, zS>(true, "sS_zS");
+
+ check_combinable<is_intra_combinable, jS, zS>(true, "jS_sS");
+ check_combinable<is_intra_combinable, zS, zS>(true, "zS_sS");
+ check_combinable<is_intra_combinable, sS, zS>(true, "sS_sS");
+
+ check_combinable<is_intra_combinable, jM, jM>(true, "jM_jM");
+ check_combinable<is_intra_combinable, sM, jM>(true, "sM_jM");
+ check_combinable<is_intra_combinable, jM, sM>(true, "jM_sM");
+ check_combinable<is_intra_combinable, sM, sM>(true, "sM_sM");
//--------------------------------------------------------------------------
BOOST_CHECK_EQUAL(map_a_b, map_b_a);
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