config.hpp 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*==============================================================================
  2. Copyright (c) 2001-2010 Joel de Guzman
  3. Copyright (c) 2010 Eric Niebler
  4. Copyright (c) 2014-2015 John Fletcher
  5. Copyright (c) 2016 Kohei Takahashi
  6. Distributed under the Boost Software License, Version 1.0. (See accompanying
  7. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  8. ==============================================================================*/
  9. #ifndef BOOST_PHOENIX_CONFIG_HPP
  10. #define BOOST_PHOENIX_CONFIG_HPP
  11. #include <boost/config.hpp>
  12. #include <boost/detail/workaround.hpp>
  13. //////////////////////////////////////////////////////////////////////////
  14. // This section is to sort out whether hash types or unordered types
  15. // are available. This depends on whether stdlib or libc++ is being used
  16. // and also whether C++11 or C++03 is being used.
  17. //////////////////////////////////////////////////////////////////////////
  18. // The idea is to set up the configuration without including the actual
  19. // headers unless that is unavoidable.
  20. //
  21. // The client code should contain the following to include headers
  22. //
  23. // #ifdef BOOST_PHOENIX_HAS_HASH
  24. // #include BOOST_PHOENIX_HASH_SET_HEADER
  25. // #include BOOST_PHOENIX_HASH_MAP_HEADER
  26. // #endif
  27. //
  28. // #ifdef BOOST_PHOENIX_HAS_UNORDERED_SET_AND_MAP
  29. // #include BOOST_PHOENIX_UNORDERED_SET_HEADER
  30. // #include BOOST_PHOENIX_UNORDERED_MAP_HEADER
  31. // #endif
  32. //
  33. // The client code can then chose the implementation provided.
  34. // See the example in test/stl/querying_find2.cpp
  35. // There is no specific thing in Boost Config for libc++
  36. #ifdef _LIBCPP_VERSION
  37. #define BOOST_PHOENIX_USING_LIBCPP
  38. #endif
  39. // This may not be true for some very old version of libc++
  40. // Current libc++ supports unordered_set and unordered_map without C++11.
  41. #if defined(BOOST_PHOENIX_USING_LIBCPP) \
  42. && !(defined(BOOST_NO_CXX11_HDR_UNORDERED_MAP) || defined(BOOST_NO_CXX11_HDR_UNORDERED_SET))
  43. // This is either libc++ or C++11 or later
  44. #define BOOST_PHOENIX_HAS_UNORDERED_SET_AND_MAP
  45. #define BOOST_PHOENIX_UNORDERED_SET_HEADER <unordered_set>
  46. #define BOOST_PHOENIX_UNORDERED_MAP_HEADER <unordered_map>
  47. #define BOOST_PHOENIX_UNORDERED_NAMESPACE std
  48. #endif
  49. #if defined(BOOST_HAS_HASH)
  50. // This is to sort out case of Clang when using stdlib from gcc
  51. // as Clang thinks it is gcc 4.2.1
  52. // This prevents the failure to include a header with a warning.
  53. #define _GLIBCXX_PERMIT_BACKWARD_HASH
  54. #define BOOST_PHOENIX_HASH_SET_HEADER BOOST_HASH_SET_HEADER
  55. #define BOOST_PHOENIX_HASH_MAP_HEADER BOOST_HASH_MAP_HEADER
  56. #define BOOST_PHOENIX_HAS_HASH
  57. #define BOOST_PHOENIX_HASH_NAMESPACE BOOST_STD_EXTENSION_NAMESPACE
  58. #define BOOST_PHOENIX_HASH_template_rest_param class Hash, class Cmp, class Alloc
  59. #define BOOST_PHOENIX_HASH_type_rest_param Hash, Cmp, Alloc
  60. #elif defined(BOOST_DINKUMWARE_STDLIB) && (BOOST_DINKUMWARE_STDLIB < 610)
  61. #define BOOST_PHOENIX_HASH_SET_HEADER <hash_set>
  62. #define BOOST_PHOENIX_HASH_MAP_HEADER <hash_map>
  63. #define BOOST_PHOENIX_HAS_HASH
  64. #define BOOST_PHOENIX_HASH_NAMESPACE stdext
  65. #define BOOST_PHOENIX_HASH_template_rest_param class Tr, class Alloc
  66. #define BOOST_PHOENIX_HASH_type_rest_param Tr, Alloc
  67. #endif
  68. #if BOOST_WORKAROUND(BOOST_GCC, < 40100)
  69. #define BOOST_PHOENIX_SFINAE_AND_OVERLOADS , void* = 0
  70. #else
  71. #define BOOST_PHOENIX_SFINAE_AND_OVERLOADS
  72. #endif
  73. #endif