Boost logo

Boost-Commit :

From: jefffaust_at_[hidden]
Date: 2007-05-31 01:39:21


Author: jefffaust
Date: 2007-05-31 01:39:21 EDT (Thu, 31 May 2007)
New Revision: 4376
URL: http://svn.boost.org/trac/boost/changeset/4376

Log:
Use full implementation provided by Danny to determine if something is an associative iterator.

Text files modified:
   sandbox/explore/boost/explore/is_assoc_iter.hpp | 24 +++++++++++++++++++++++-
   1 files changed, 23 insertions(+), 1 deletions(-)

Modified: sandbox/explore/boost/explore/is_assoc_iter.hpp
==============================================================================
--- sandbox/explore/boost/explore/is_assoc_iter.hpp (original)
+++ sandbox/explore/boost/explore/is_assoc_iter.hpp 2007-05-31 01:39:21 EDT (Thu, 31 May 2007)
@@ -12,8 +12,11 @@
 #ifndef STREAM_IS_ASSOC_ITER_INCLUDED
 #define STREAM_IS_ASSOC_ITER_INCLUDED
 
+#include <map>
 #include <boost/mpl/bool.hpp>
 #include <boost/mpl/eval_if.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/type_traits/remove_const.hpp>
 
 namespace explore
 {
@@ -54,6 +57,24 @@
 
         template<typename T>
         struct value_type_is_pair : is_pair<typename T::value_type> {};
+
+ template< typename value_t, typename iterator_t>
+ struct pair_matches_map : boost::mpl::false_ {};
+
+ template< typename F, typename S, typename iterator_t>
+ struct pair_matches_map< std::pair< F, S>, iterator_t> :
+ boost::is_same<
+ iterator_t,
+ typename std::map<
+ typename boost::remove_const<F>::type,
+ S
+ >::iterator
+ >
+ {};
+
+ template <typename T>
+ struct value_matches_map :
+ pair_matches_map< typename T::value_type, T> {};
     }
 
     // an associative iterator has a value type of pair<>
@@ -61,7 +82,8 @@
     struct is_assoc_iter :
         boost::mpl::eval_if<
             detail::has_value_type<T>,
- detail::value_type_is_pair<T>,
+// detail::value_type_is_pair<T>,
+ detail::value_matches_map<T>,
             boost::mpl::false_
> {};
 }


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