Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r53697 - in trunk: boost/spirit/home/phoenix/stl/algorithm/detail libs/spirit/phoenix/test/algorithm
From: steven_at_[hidden]
Date: 2009-06-06 14:20:37


Author: steven_watanabe
Date: 2009-06-06 14:20:36 EDT (Sat, 06 Jun 2009)
New Revision: 53697
URL: http://svn.boost.org/trac/boost/changeset/53697

Log:
Fix forward declarations of hash containers. Fixes #3142
Text files modified:
   trunk/boost/spirit/home/phoenix/stl/algorithm/detail/is_std_hash_map.hpp | 43 ++++++++++++++++++++++++++++++++++-----
   trunk/boost/spirit/home/phoenix/stl/algorithm/detail/is_std_hash_set.hpp | 39 ++++++++++++++++++++++++++++++-----
   trunk/boost/spirit/home/phoenix/stl/algorithm/detail/std_hash_map_fwd.hpp | 33 +++++++++++++++++++++++++++++
   trunk/boost/spirit/home/phoenix/stl/algorithm/detail/std_hash_set_fwd.hpp | 29 ++++++++++++++++++++++++++
   trunk/libs/spirit/phoenix/test/algorithm/querying.cpp | 29 ++++++++++++++++++++++++++
   5 files changed, 159 insertions(+), 14 deletions(-)

Modified: trunk/boost/spirit/home/phoenix/stl/algorithm/detail/is_std_hash_map.hpp
==============================================================================
--- trunk/boost/spirit/home/phoenix/stl/algorithm/detail/is_std_hash_map.hpp (original)
+++ trunk/boost/spirit/home/phoenix/stl/algorithm/detail/is_std_hash_map.hpp 2009-06-06 14:20:36 EDT (Sat, 06 Jun 2009)
@@ -29,28 +29,59 @@
         : boost::mpl::false_
     {};
 
+ template<class T>
+ struct is_std_hash_multimap
+ : boost::mpl::false_
+ {};
+
+#ifdef BOOST_HAS_HASH
+
     template<
         class Kty
- , class Tr
+ , class Ty
+ , class Hash
+ , class Cmp
       , class Alloc
>
- struct is_std_hash_map< ::stdext::hash_map<Kty,Tr,Alloc> >
+ struct is_std_hash_map< ::BOOST_STD_EXTENSION_NAMESPACE::hash_map<Kty,Ty,Hash,Cmp,Alloc> >
         : boost::mpl::true_
     {};
 
- template<class T>
- struct is_std_hash_multimap
- : boost::mpl::false_
+ template<
+ class Kty
+ , class Ty
+ , class Hash
+ , class Cmp
+ , class Alloc
+ >
+ struct is_std_hash_multimap< ::BOOST_STD_EXTENSION_NAMESPACE::hash_multimap<Kty,Ty,Hash,Cmp,Alloc> >
+ : boost::mpl::true_
     {};
 
+#elif defined(BOOST_DINKUMWARE_STDLIB)
+
     template<
         class Kty
+ , class Ty
       , class Tr
       , class Alloc
>
- struct is_std_hash_multimap< ::stdext::hash_multimap<Kty,Tr,Alloc> >
+ struct is_std_hash_map< ::BOOST_STD_EXTENSION_NAMESPACE::hash_map<Kty,Ty,Tr,Alloc> >
         : boost::mpl::true_
     {};
+
+ template<
+ class Kty
+ , class Ty
+ , class Tr
+ , class Alloc
+ >
+ struct is_std_hash_multimap< ::BOOST_STD_EXTENSION_NAMESPACE::hash_multimap<Kty,Ty,Tr,Alloc> >
+ : boost::mpl::true_
+ {};
+
+#endif
+
 }
 
 #endif

Modified: trunk/boost/spirit/home/phoenix/stl/algorithm/detail/is_std_hash_set.hpp
==============================================================================
--- trunk/boost/spirit/home/phoenix/stl/algorithm/detail/is_std_hash_set.hpp (original)
+++ trunk/boost/spirit/home/phoenix/stl/algorithm/detail/is_std_hash_set.hpp 2009-06-06 14:20:36 EDT (Sat, 06 Jun 2009)
@@ -29,28 +29,55 @@
         : boost::mpl::false_
     {};
 
+ template<class T>
+ struct is_std_hash_multiset
+ : boost::mpl::false_
+ {};
+
+#if defined(BOOST_HAS_HASH)
+
     template<
         class Kty
- , class Tr
+ , class Hash
+ , class Cmp
       , class Alloc
>
- struct is_std_hash_set< ::stdext::hash_set<Kty,Tr,Alloc> >
+ struct is_std_hash_set< ::BOOST_STD_EXTENSION_NAMESPACE::hash_set<Kty,Hash,Cmp,Alloc> >
         : boost::mpl::true_
     {};
 
- template<class T>
- struct is_std_hash_multiset
- : boost::mpl::false_
+ template<
+ class Kty
+ , class Hash
+ , class Cmp
+ , class Alloc
+ >
+ struct is_std_hash_multiset< ::BOOST_STD_EXTENSION_NAMESPACE::hash_multiset<Kty,Hash,Cmp,Alloc> >
+ : boost::mpl::true_
     {};
 
+#elif defined(BOOST_DINKUMWARE_STDLIB)
+
     template<
         class Kty
       , class Tr
       , class Alloc
>
- struct is_std_hash_multiset< ::stdext::hash_multiset<Kty,Tr,Alloc> >
+ struct is_std_hash_set< ::BOOST_STD_EXTENSION_NAMESPACE::hash_set<Kty,Tr,Alloc> >
         : boost::mpl::true_
     {};
+
+ template<
+ class Kty
+ , class Tr
+ , class Alloc
+ >
+ struct is_std_hash_multiset< ::BOOST_STD_EXTENSION_NAMESPACE::hash_multiset<Kty,Tr,Alloc> >
+ : boost::mpl::true_
+ {};
+
+#endif
+
 }
 
 #endif

Modified: trunk/boost/spirit/home/phoenix/stl/algorithm/detail/std_hash_map_fwd.hpp
==============================================================================
--- trunk/boost/spirit/home/phoenix/stl/algorithm/detail/std_hash_map_fwd.hpp (original)
+++ trunk/boost/spirit/home/phoenix/stl/algorithm/detail/std_hash_map_fwd.hpp 2009-06-06 14:20:36 EDT (Sat, 06 Jun 2009)
@@ -19,10 +19,38 @@
 #ifndef STD_HASH_MAP_FWD_EN_16_12_2004
 #define STD_HASH_MAP_FWD_EN_16_12_2004
 
-namespace stdext
+#include <boost/config.hpp>
+
+#if defined(BOOST_HAS_HASH)
+
+namespace BOOST_STD_EXTENSION_NAMESPACE
 {
     template<
         class Kty
+ , class Ty
+ , class Hash
+ , class Cmp
+ , class Alloc
+ >
+ class hash_map;
+
+ template<
+ class Kty
+ , class Ty
+ , class Hash
+ , class Cmp
+ , class Alloc
+ >
+ class hash_multimap;
+}
+
+#elif defined(BOOST_DINKUMWARE_STDLIB)
+
+namespace BOOST_STD_EXTENSION_NAMESPACE
+{
+ template<
+ class Kty
+ , class Ty
       , class Tr
       , class Alloc
>
@@ -30,6 +58,7 @@
 
     template<
         class Kty
+ , class Ty
       , class Tr
       , class Alloc
>
@@ -37,3 +66,5 @@
 }
 
 #endif
+
+#endif

Modified: trunk/boost/spirit/home/phoenix/stl/algorithm/detail/std_hash_set_fwd.hpp
==============================================================================
--- trunk/boost/spirit/home/phoenix/stl/algorithm/detail/std_hash_set_fwd.hpp (original)
+++ trunk/boost/spirit/home/phoenix/stl/algorithm/detail/std_hash_set_fwd.hpp 2009-06-06 14:20:36 EDT (Sat, 06 Jun 2009)
@@ -19,7 +19,32 @@
 #ifndef STD_HASH_SET_FWD_EN_16_12_2004
 #define STD_HASH_SET_FWD_EN_16_12_2004
 
-namespace stdext
+#include <boost/config.hpp>
+
+#if defined(BOOST_HAS_HASH)
+
+namespace BOOST_STD_EXTENSION_NAMESPACE
+{
+ template<
+ class Kty
+ , class Hash
+ , class Cmp
+ , class Alloc
+ >
+ class hash_set;
+
+ template<
+ class Kty
+ , class Hash
+ , class Cmp
+ , class Alloc
+ >
+ class hash_multiset;
+}
+
+#elif defined(BOOST_DINKUMWARE_STDLIB)
+
+namespace BOOST_STD_EXTENSION_NAMESPACE
 {
     template<
         class Kty
@@ -37,3 +62,5 @@
 }
 
 #endif
+
+#endif

Modified: trunk/libs/spirit/phoenix/test/algorithm/querying.cpp
==============================================================================
--- trunk/libs/spirit/phoenix/test/algorithm/querying.cpp (original)
+++ trunk/libs/spirit/phoenix/test/algorithm/querying.cpp 2009-06-06 14:20:36 EDT (Sat, 06 Jun 2009)
@@ -10,8 +10,24 @@
 #include <boost/spirit/home/phoenix/stl/algorithm/querying.hpp>
 #include <boost/spirit/include/phoenix_core.hpp>
 #include <boost/detail/lightweight_test.hpp>
+#include <boost/assign/list_of.hpp>
+
+#include <boost/config.hpp>
+
+#ifdef BOOST_HAS_HASH
+#include BOOST_HASH_SET_HEADER
+#include BOOST_HASH_MAP_HEADER
+#define BOOST_PHOENIX_HAS_HASH
+#define BOOST_PHOENIX_HASH_NAMESPACE BOOST_STD_EXTENSION_NAMESPACE
+#elif defined(BOOST_DINKUMWARE_STDLIB)
+#include <hash_set>
+#include <hash_map>
+#define BOOST_PHOENIX_HAS_HASH
+#define BOOST_PHOENIX_HASH_NAMESPACE stdext
+#endif
 
 #include <set>
+#include <map>
 #include <functional>
 
 namespace
@@ -44,6 +60,19 @@
         std::set<int> s(array, array + 3);
         BOOST_TEST(find(arg1, 2)(s) == s.find(2));
 
+ std::map<int, int> m = boost::assign::map_list_of(0, 1)(2, 3)(4, 5);
+ BOOST_TEST(find(arg1, 2)(m) == m.find(2));
+
+#ifdef BOOST_PHOENIX_HAS_HASH
+
+ BOOST_PHOENIX_HASH_NAMESPACE::hash_set<int> hs(array, array + 3);
+ BOOST_TEST(find(arg1, 2)(hs) == hs.find(2));
+
+ BOOST_PHOENIX_HASH_NAMESPACE::hash_map<int, int> hm = boost::assign::map_list_of(0, 1)(2, 3)(4, 5);
+ BOOST_TEST(find(arg1, 2)(hm) == hm.find(2));
+
+#endif
+
         return;
     }
 


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