diff --git a/include/boost/phoenix/config.hpp b/include/boost/phoenix/config.hpp index 9f2138c8..ad81c019 100644 --- a/include/boost/phoenix/config.hpp +++ b/include/boost/phoenix/config.hpp @@ -2,6 +2,7 @@ Copyright (c) 2001-2010 Joel de Guzman Copyright (c) 2010 Eric Niebler Copyright (c) 2014-2015 John Fletcher + Copyright (c) 2016 Kohei Takahashi Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -27,50 +28,43 @@ // #endif // // #ifdef BOOST_PHOENIX_HAS_UNORDERED_SET_AND_MAP -// #define BOOST_PHOENIX_UNORDERED_SET_HEADER -// #define BOOST_PHOENIX_UNORDERED_MAP_HEADER +// #include BOOST_PHOENIX_UNORDERED_SET_HEADER +// #include BOOST_PHOENIX_UNORDERED_MAP_HEADER // #endif // // The client code can then chose the implementation provided. // See the example in test/stl/querying_find2.cpp -// -////////////////////////////////////////////////////////////////////////// -// + // There is no specific thing in Boost Config for libc++ #ifdef _LIBCPP_VERSION #define BOOST_PHOENIX_USING_LIBCPP +#endif + // This may not be true for some very old version of libc++ // Current libc++ supports unordered_set and unordered_map without C++11. -#undef BOOST_NO_CXX11_HDR_UNORDERED_MAP -#undef BOOST_NO_CXX11_HDR_UNORDERED_SET +#if defined(BOOST_PHOENIX_USING_LIBCPP) \ + && !(defined(BOOST_NO_CXX11_HDR_UNORDERED_MAP) || defined(BOOST_NO_CXX11_HDR_UNORDERED_SET)) +// This is either libc++ or C++11 or later +#define BOOST_PHOENIX_HAS_UNORDERED_SET_AND_MAP +#define BOOST_PHOENIX_UNORDERED_SET_HEADER +#define BOOST_PHOENIX_UNORDERED_MAP_HEADER +#define BOOST_PHOENIX_UNORDERED_NAMESPACE std #endif -#if (!defined(BOOST_PHOENIX_USING_LIBCPP) \ - && (defined (BOOST_NO_CXX11_HDR_UNORDERED_MAP) || \ - defined (BOOST_NO_CXX11_HDR_UNORDERED_SET) ) ) -#ifdef BOOST_HAS_HASH +#if defined(BOOST_HAS_HASH) // This is to sort out case of Clang when using stdlib from gcc // as Clang thinks it is gcc 4.2.1 // This prevents the failure to include a header with a warning. #define _GLIBCXX_PERMIT_BACKWARD_HASH -#define BOOST_PHOENIX_PERMIT_BACKWARD_HASH #define BOOST_PHOENIX_HASH_SET_HEADER BOOST_HASH_SET_HEADER #define BOOST_PHOENIX_HASH_MAP_HEADER BOOST_HASH_MAP_HEADER #define BOOST_PHOENIX_HAS_HASH #define BOOST_PHOENIX_HASH_NAMESPACE BOOST_STD_EXTENSION_NAMESPACE - #elif defined(BOOST_DINKUMWARE_STDLIB) && (BOOST_DINKUMWARE_STDLIB < 610) #define BOOST_PHOENIX_HASH_SET_HEADER #define BOOST_PHOENIX_HASH_MAP_HEADER #define BOOST_PHOENIX_HAS_HASH #define BOOST_PHOENIX_HASH_NAMESPACE stdext #endif -#else -// This is either libc++ or C++11 or later -#define BOOST_PHOENIX_HAS_UNORDERED_SET_AND_MAP -#define BOOST_PHOENIX_UNORDERED_SET_HEADER -#define BOOST_PHOENIX_UNORDERED_MAP_HEADER -#define BOOST_PHOENIX_UNORDERED_NAMESPACE std -#endif #endif diff --git a/include/boost/phoenix/stl/algorithm/detail/std_unordered_set_or_map_fwd.hpp b/include/boost/phoenix/stl/algorithm/detail/std_unordered_set_or_map_fwd.hpp index 2e1a8436..e650328d 100644 --- a/include/boost/phoenix/stl/algorithm/detail/std_unordered_set_or_map_fwd.hpp +++ b/include/boost/phoenix/stl/algorithm/detail/std_unordered_set_or_map_fwd.hpp @@ -23,8 +23,8 @@ #if defined(BOOST_PHOENIX_USING_LIBCPP) \ || (defined(BOOST_DINKUMWARE_STDLIB) && (BOOST_DINKUMWARE_STDLIB < 540)) // Advance declaration not working for libc++ and MSVC 10 -#include -#include +#include BOOST_PHOENIX_UNORDERED_SET_HEADER +#include BOOST_PHOENIX_UNORDERED_MAP_HEADER #else diff --git a/test/algorithm/querying.cpp b/test/algorithm/querying.cpp index 2ab97c63..fd9b9124 100644 --- a/test/algorithm/querying.cpp +++ b/test/algorithm/querying.cpp @@ -15,17 +15,10 @@ #include -#ifdef BOOST_HAS_HASH +#ifdef BOOST_PHOENIX_HAS_HASH #define _GLIBCXX_PERMIT_BACKWARD_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) && (BOOST_DINKUMWARE_STDLIB < 610) -#include -#include -#define BOOST_PHOENIX_HAS_HASH -#define BOOST_PHOENIX_HASH_NAMESPACE stdext #endif #include diff --git a/test/algorithm/querying_find.cpp b/test/algorithm/querying_find.cpp index 976a1070..99707aa2 100644 --- a/test/algorithm/querying_find.cpp +++ b/test/algorithm/querying_find.cpp @@ -15,29 +15,13 @@ #include -#if defined(BOOST_DINKUMWARE_STDLIB) && (BOOST_DINKUMWARE_STDLIB < 610) -#include -#include -#define BOOST_PHOENIX_HAS_HASH -#define BOOST_PHOENIX_HASH_NAMESPACE stdext -#else -#if (defined (BOOST_NO_CXX11_HDR_UNORDERED_MAP) || \ - defined (BOOST_NO_CXX11_HDR_UNORDERED_SET) ) -#ifdef BOOST_HAS_HASH -// This does not work for Clang when using stdlib from gcc 4.9 -// as Clang thinks it is gcc 4.2.1 -//#ifndef BOOST_COMP_CLANG -#define _GLIBCXX_PERMIT_BACKWARD_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 -#endif -#else -#define BOOST_PHOENIX_HAS_UNORDERED_SET_AND_MAP -#include -#include +#ifdef BOOST_PHOENIX_HAS_HASH +#include BOOST_PHOENIX_HASH_SET_HEADER +#include BOOST_PHOENIX_HASH_MAP_HEADER #endif +#ifdef BOOST_PHOENIX_HAS_UNORDERED_SET_AND_MAP +#include BOOST_PHOENIX_UNORDERED_SET_HEADER +#include BOOST_PHOENIX_UNORDERED_MAP_HEADER #endif #include @@ -89,7 +73,9 @@ namespace convert_to_container >(); BOOST_TEST(boost::phoenix::find(arg1, 2)(hm) == hm.find(2)); -#elif defined BOOST_PHOENIX_HAS_UNORDERED_SET_AND_MAP +#endif +#ifdef BOOST_PHOENIX_HAS_UNORDERED_SET_AND_MAP + std::unordered_set us(array, array + 3); BOOST_TEST(boost::phoenix::find(arg1, 2)(us) == us.find(2)); diff --git a/test/algorithm/querying_find2.cpp b/test/algorithm/querying_find2.cpp index f1ee475f..9f6b8c54 100644 --- a/test/algorithm/querying_find2.cpp +++ b/test/algorithm/querying_find2.cpp @@ -22,17 +22,12 @@ #ifdef BOOST_PHOENIX_HAS_HASH #include BOOST_PHOENIX_HASH_SET_HEADER #include BOOST_PHOENIX_HASH_MAP_HEADER -#elif defined(BOOST_DINKUMWARE_STDLIB) && (BOOST_DINKUMWARE_STDLIB < 610) -#include -#include -#define BOOST_PHOENIX_HAS_HASH -#define BOOST_PHOENIX_HASH_NAMESPACE stdext -#elif defined BOOST_PHOENIX_HAS_UNORDERED_SET_AND_MAP +#endif +#ifdef BOOST_PHOENIX_HAS_UNORDERED_SET_AND_MAP #include BOOST_PHOENIX_UNORDERED_SET_HEADER #include BOOST_PHOENIX_UNORDERED_MAP_HEADER #endif - namespace { struct even @@ -76,7 +71,8 @@ namespace convert_to_container >(); BOOST_TEST(boost::phoenix::find(arg1, 2)(hm) == hm.find(2)); -#elif defined BOOST_PHOENIX_HAS_UNORDERED_SET_AND_MAP +#endif +#ifdef BOOST_PHOENIX_HAS_UNORDERED_SET_AND_MAP std::unordered_set us(array, array + 3); BOOST_TEST(boost::phoenix::find(arg1, 2)(us) == us.find(2));