Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r55071 - sandbox/itl/boost/itl
From: afojgo_at_[hidden]
Date: 2009-07-21 13:13:34


Author: jofaber
Date: 2009-07-21 13:13:34 EDT (Tue, 21 Jul 2009)
New Revision: 55071
URL: http://svn.boost.org/trac/boost/changeset/55071

Log:
Restored predicate disjoint as Set::is_disjoint.
Text files modified:
   sandbox/itl/boost/itl/set.hpp | 2 +-
   sandbox/itl/boost/itl/set_algo.hpp | 22 ++++++++++++++++++++++
   2 files changed, 23 insertions(+), 1 deletions(-)

Modified: sandbox/itl/boost/itl/set.hpp
==============================================================================
--- sandbox/itl/boost/itl/set.hpp (original)
+++ sandbox/itl/boost/itl/set.hpp 2009-07-21 13:13:34 EDT (Tue, 21 Jul 2009)
@@ -134,7 +134,7 @@
     bool contains(const set& sub)const { return Set::contained_in(sub, *this); }
 
     /** <tt>*this</tt> and <tt>x2</tt> are disjoint, if their intersection is empty */
- bool disjoint(const set& x2)const { return Set::disjoint(*this, x2); }
+ bool is_disjoint(const set& x2)const { return Set::is_disjoint(*this, x2); }
 
     //==========================================================================
     //= Size

Modified: sandbox/itl/boost/itl/set_algo.hpp
==============================================================================
--- sandbox/itl/boost/itl/set_algo.hpp (original)
+++ sandbox/itl/boost/itl/set_algo.hpp 2009-07-21 13:13:34 EDT (Tue, 21 Jul 2009)
@@ -135,6 +135,28 @@
             return true;
         }
 
+ template<class SetType>
+ bool is_disjoint(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;
+
+ typename SetType::const_iterator right_ = common_lwb_right_, found_;
+
+ while(right_ != common_upb_right_)
+ {
+ found_ = left.find(*right_++);
+ if(found_ != left.end())
+ return false; // found a common element
+ }
+ // found no common element
+ return true;
+ }
+
+
         /** Function template <tt>lexicographical_equal</tt> implements
         lexicographical equality. */
         template<class SetType>


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