functional.hpp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. // (C) Copyright John Maddock 2005.
  2. // Use, modification and distribution are subject to the
  3. // Boost Software License, Version 1.0. (See accompanying file
  4. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. #ifndef BOOST_TR1_FUNCTIONAL_HPP_INCLUDED
  6. # define BOOST_TR1_FUNCTIONAL_HPP_INCLUDED
  7. # include <boost/tr1/detail/config.hpp>
  8. # include <functional>
  9. #if defined(BOOST_HAS_TR1_REFERENCE_WRAPPER) \
  10. || defined(BOOST_HAS_TR1_RESULT_OF)\
  11. || defined(BOOST_HAS_TR1_MEM_FN)\
  12. || defined(BOOST_HAS_TR1_BIND)\
  13. || defined(BOOST_HAS_TR1_FUNCTION)\
  14. || defined(BOOST_HAS_TR1_HASH)
  15. # if defined(BOOST_HAS_INCLUDE_NEXT) && !defined(BOOST_TR1_DISABLE_INCLUDE_NEXT)
  16. # include_next BOOST_TR1_HEADER(functional)
  17. # else
  18. # include <boost/tr1/detail/config_all.hpp>
  19. # include BOOST_TR1_STD_HEADER(BOOST_TR1_PATH(functional))
  20. # endif
  21. #endif
  22. #ifndef BOOST_HAS_TR1_REFERENCE_WRAPPER
  23. #include <boost/ref.hpp>
  24. namespace std{ namespace tr1{
  25. using ::boost::reference_wrapper;
  26. using ::boost::ref;
  27. using ::boost::cref;
  28. } }
  29. #endif // BOOST_HAS_TR1_REFERENCE_WRAPPER
  30. #if !defined(BOOST_HAS_TR1_RESULT_OF)\
  31. && !defined(BOOST_NO_SFINAE) && \
  32. !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
  33. //
  34. // we can only actually include result_of.hpp if the compiler
  35. // really does support it, otherwise we just get endless errors...
  36. //
  37. #include <boost/utility/result_of.hpp>
  38. namespace std{ namespace tr1{
  39. template<class F>
  40. struct result_of
  41. : ::boost::tr1_result_of<F>
  42. {};
  43. } }
  44. #endif // BOOST_HAS_TR1_RESULT_OF
  45. #ifndef BOOST_HAS_TR1_MEM_FN
  46. // mem_fn:
  47. #include <boost/mem_fn.hpp>
  48. namespace std{ namespace tr1{
  49. using boost::mem_fn;
  50. } }
  51. #endif // BOOST_HAS_TR1_MEM_FN
  52. #ifndef BOOST_HAS_TR1_BIND
  53. // Bind:
  54. #include <boost/bind.hpp>
  55. namespace std{ namespace tr1{
  56. using ::boost::is_bind_expression;
  57. using ::boost::is_placeholder;
  58. using ::boost::bind;
  59. namespace placeholders {
  60. #ifndef BOOST_BIND_NO_PLACEHOLDERS
  61. using ::_1;
  62. using ::_2;
  63. using ::_3;
  64. using ::_4;
  65. using ::_5;
  66. using ::_6;
  67. using ::_7;
  68. using ::_8;
  69. using ::_9;
  70. #endif
  71. } // placeholders
  72. } }
  73. #endif
  74. #ifndef BOOST_HAS_TR1_FUNCTION
  75. // polymorphic function object wrappers:
  76. #include <boost/function.hpp>
  77. #include <boost/detail/workaround.hpp>
  78. #if !BOOST_WORKAROUND(__BORLANDC__, < 0x582) \
  79. && !BOOST_WORKAROUND(BOOST_MSVC, < 1310) \
  80. && !defined(BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX)
  81. namespace std{ namespace tr1{
  82. using ::boost::bad_function_call;
  83. using ::boost::function;
  84. using ::boost::swap;
  85. }}
  86. #endif
  87. #endif // BOOST_HAS_TR1_FUNCTION
  88. #ifndef BOOST_HAS_TR1_HASH
  89. //
  90. // This header can get included by boost/hash.hpp
  91. // leading to cyclic dependencies. As a workaround
  92. // we forward declare boost::hash and include
  93. // the actual header later.
  94. //
  95. namespace boost{
  96. template <class T> struct hash;
  97. }
  98. namespace std{ namespace tr1{
  99. //using ::boost::hash;
  100. template <class T>
  101. struct hash : public boost::hash<T>
  102. {
  103. };
  104. }}
  105. #include <boost/functional/hash.hpp>
  106. #endif
  107. #endif