Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r69441 - trunk/boost/icl/concept
From: afojgo_at_[hidden]
Date: 2011-03-01 06:11:30


Author: jofaber
Date: 2011-03-01 06:11:26 EST (Tue, 01 Mar 2011)
New Revision: 69441
URL: http://svn.boost.org/trac/boost/changeset/69441

Log:
Fixed a bug (gcc) introduced by adding icl::find.
Text files modified:
   trunk/boost/icl/concept/interval_associator.hpp | 51 -------------------------------------
   trunk/boost/icl/concept/interval_map.hpp | 54 ++++++++++++++++++++++++++++++++++++++++
   trunk/boost/icl/concept/interval_set.hpp | 54 ++++++++++++++++++++++++++++++++++++++++
   3 files changed, 108 insertions(+), 51 deletions(-)

Modified: trunk/boost/icl/concept/interval_associator.hpp
==============================================================================
--- trunk/boost/icl/concept/interval_associator.hpp (original)
+++ trunk/boost/icl/concept/interval_associator.hpp 2011-03-01 06:11:26 EST (Tue, 01 Mar 2011)
@@ -203,57 +203,6 @@
 }
 
 //==============================================================================
-//= Selection<IntervalSet|IntervalMap>
-//==============================================================================
-template<class Type>
-typename enable_if<mpl::and_< is_interval_container<Type>
- , is_discrete<typename domain_type_of<Type>::type>
- >
- , typename Type::const_iterator>::type
-find(const Type& object, const typename domain_type_of<Type>::type& key_val)
-{
- typedef typename Type::const_iterator const_iterator;
- typedef typename Type::interval_type interval_type;
- return object.find(icl::unit_closure<interval_type>(key_val));
-}
-
-template<class Type>
-typename enable_if<mpl::and_< is_interval_container<Type>
- , is_continuous<typename domain_type_of<Type>::type>
- , has_dynamic_bounds<typename interval_type_of<Type>::type>
- >
- , typename Type::const_iterator>::type
-find(const Type& object, const typename domain_type_of<Type>::type& key_val)
-{
- typedef typename Type::const_iterator const_iterator;
- typedef typename Type::interval_type interval_type;
- return object.find(icl::singleton<interval_type>(key_val));
-}
-
-template<class Type>
-typename enable_if<mpl::and_< is_interval_container<Type>
- , is_continuous<typename domain_type_of<Type>::type>
- , has_static_bounds<typename interval_type_of<Type>::type>
- , boost::detail::is_incrementable<typename domain_type_of<Type>::type>
- >
- , typename Type::const_iterator>::type
-find(const Type& object, const typename domain_type_of<Type>::type& key_val)
-{
- typedef typename Type::const_iterator const_iterator;
- typedef typename Type::interval_type interval_type;
- const_iterator collision = object.find(icl::unit_closure<interval_type>(key_val));
- // A part of the cover(key_value)-interval may be found in the container, that
- // does not contain key_value. Therefore we have to check for its existence:
- return ( collision == object.end()
- || icl::contains(key_value<Type>(collision), key_val) )
- ? collision
- : object.end();
-}
-
-// NOTE: find(object, key) won't compile if key is of continuous type that does
-// not implement in(de)crementation (e.g. std::string).
-
-//==============================================================================
 //= Range<IntervalSet|IntervalMap>
 //==============================================================================
 template<class Type>

Modified: trunk/boost/icl/concept/interval_map.hpp
==============================================================================
--- trunk/boost/icl/concept/interval_map.hpp (original)
+++ trunk/boost/icl/concept/interval_map.hpp 2011-03-01 06:11:26 EST (Tue, 01 Mar 2011)
@@ -36,6 +36,60 @@
     return segment_type(icl::singleton<interval_type>(element.key), element.data);
 }
 
+
+//==============================================================================
+//= Selection<IntervalMap>
+//==============================================================================
+template<class Type>
+typename enable_if<mpl::and_< is_interval_map<Type>
+ , is_discrete<typename domain_type_of<Type>::type>
+ >
+ , typename Type::const_iterator>::type
+find(const Type& object, const typename domain_type_of<Type>::type& key_val)
+{
+ typedef typename Type::const_iterator const_iterator;
+ typedef typename Type::interval_type interval_type;
+ return object.find(icl::unit_closure<interval_type>(key_val));
+}
+
+template<class Type>
+typename enable_if<mpl::and_< is_interval_map<Type>
+ , is_continuous<typename domain_type_of<Type>::type>
+ , has_dynamic_bounds<typename interval_type_of<Type>::type>
+ >
+ , typename Type::const_iterator>::type
+find(const Type& object, const typename domain_type_of<Type>::type& key_val)
+{
+ typedef typename Type::const_iterator const_iterator;
+ typedef typename Type::interval_type interval_type;
+ return object.find(icl::singleton<interval_type>(key_val));
+}
+
+template<class Type>
+typename enable_if<mpl::and_< is_interval_map<Type>
+ , is_continuous<typename domain_type_of<Type>::type>
+ , has_static_bounds<typename interval_type_of<Type>::type>
+ , boost::detail::is_incrementable<typename domain_type_of<Type>::type>
+ >
+ , typename Type::const_iterator>::type
+find(const Type& object, const typename domain_type_of<Type>::type& key_val)
+{
+ typedef typename Type::const_iterator const_iterator;
+ typedef typename Type::interval_type interval_type;
+ const_iterator collision = object.find(icl::unit_closure<interval_type>(key_val));
+ // A part of the cover(key_value)-interval may be found in the container, that
+ // does not contain key_value. Therefore we have to check for its existence:
+ return ( collision == object.end()
+ || icl::contains(key_value<Type>(collision), key_val) )
+ ? collision
+ : object.end();
+}
+
+// NOTE: find(object, key) won't compile if key is of continuous type that does
+// not implement in(de)crementation (e.g. std::string).
+
+
+
 //==============================================================================
 //= Containedness<IntervalMap>
 //==============================================================================

Modified: trunk/boost/icl/concept/interval_set.hpp
==============================================================================
--- trunk/boost/icl/concept/interval_set.hpp (original)
+++ trunk/boost/icl/concept/interval_set.hpp 2011-03-01 06:11:26 EST (Tue, 01 Mar 2011)
@@ -9,6 +9,7 @@
 #define BOOST_ICL_CONCEPT_INTERVAL_SET_HPP_JOFA_100920
 
 #include <boost/icl/type_traits/is_combinable.hpp>
+#include <boost/icl/type_traits/interval_type_of.hpp>
 #include <boost/icl/detail/set_algo.hpp>
 #include <boost/icl/detail/interval_set_algo.hpp>
 #include <boost/icl/concept/interval.hpp>
@@ -17,6 +18,59 @@
 {
 
 //==============================================================================
+//= Selection<IntervalSet>
+//==============================================================================
+template<class Type>
+typename enable_if<mpl::and_< is_interval_set<Type>
+ , is_discrete<typename domain_type_of<Type>::type>
+ >
+ , typename Type::const_iterator>::type
+find(const Type& object, const typename domain_type_of<Type>::type& key_val)
+{
+ typedef typename Type::const_iterator const_iterator;
+ typedef typename Type::interval_type interval_type;
+ return object.find(icl::unit_closure<interval_type>(key_val));
+}
+
+template<class Type>
+typename enable_if<mpl::and_< is_interval_set<Type>
+ , is_continuous<typename domain_type_of<Type>::type>
+ , has_dynamic_bounds<typename interval_type_of<Type>::type>
+ >
+ , typename Type::const_iterator>::type
+find(const Type& object, const typename domain_type_of<Type>::type& key_val)
+{
+ typedef typename Type::const_iterator const_iterator;
+ typedef typename Type::interval_type interval_type;
+ return object.find(icl::singleton<interval_type>(key_val));
+}
+
+template<class Type>
+typename enable_if<mpl::and_< is_interval_set<Type>
+ , is_continuous<typename domain_type_of<Type>::type>
+ , has_static_bounds<typename interval_type_of<Type>::type>
+ , boost::detail::is_incrementable<typename domain_type_of<Type>::type>
+ >
+ , typename Type::const_iterator>::type
+find(const Type& object, const typename domain_type_of<Type>::type& key_val)
+{
+ typedef typename Type::const_iterator const_iterator;
+ typedef typename Type::interval_type interval_type;
+ const_iterator collision = object.find(icl::unit_closure<interval_type>(key_val));
+ // A part of the cover(key_value)-interval may be found in the container, that
+ // does not contain key_value. Therefore we have to check for its existence:
+ return ( collision == object.end()
+ || icl::contains(key_value<Type>(collision), key_val) )
+ ? collision
+ : object.end();
+}
+
+// NOTE: find(object, key) won't compile if key is of continuous type that does
+// not implement in(de)crementation (e.g. std::string).
+
+
+
+//==============================================================================
 //= Containedness<IntervalSet>
 //==============================================================================
 //------------------------------------------------------------------------------


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