functional.hpp 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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. //
  33. // we can only actually include result_of.hpp if the compiler
  34. // really does support it, otherwise we just get endless errors...
  35. //
  36. #include <boost/utility/result_of.hpp>
  37. namespace std{ namespace tr1{
  38. template<class F>
  39. struct result_of
  40. : ::boost::tr1_result_of<F>
  41. {};
  42. } }
  43. #endif // BOOST_HAS_TR1_RESULT_OF
  44. #ifndef BOOST_HAS_TR1_MEM_FN
  45. // mem_fn:
  46. #include <boost/mem_fn.hpp>
  47. namespace std{ namespace tr1{
  48. using boost::mem_fn;
  49. } }
  50. #endif // BOOST_HAS_TR1_MEM_FN
  51. #ifndef BOOST_HAS_TR1_BIND
  52. // Bind:
  53. #include <boost/bind.hpp>
  54. namespace std{ namespace tr1{
  55. using ::boost::is_bind_expression;
  56. using ::boost::is_placeholder;
  57. using ::boost::bind;
  58. namespace placeholders {
  59. #ifndef BOOST_BIND_NO_PLACEHOLDERS
  60. using ::_1;
  61. using ::_2;
  62. using ::_3;
  63. using ::_4;
  64. using ::_5;
  65. using ::_6;
  66. using ::_7;
  67. using ::_8;
  68. using ::_9;
  69. #endif
  70. } // placeholders
  71. } }
  72. #endif
  73. #ifndef BOOST_HAS_TR1_FUNCTION
  74. // polymorphic function object wrappers:
  75. #include <boost/function.hpp>
  76. #include <boost/detail/workaround.hpp>
  77. #if !BOOST_WORKAROUND(__BORLANDC__, < 0x582) \
  78. && !defined(BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX)
  79. namespace std{ namespace tr1{
  80. using ::boost::bad_function_call;
  81. using ::boost::function;
  82. using ::boost::swap;
  83. }}
  84. #endif
  85. #endif // BOOST_HAS_TR1_FUNCTION
  86. #ifndef BOOST_HAS_TR1_HASH
  87. //
  88. // This header can get included by boost/hash.hpp
  89. // leading to cyclic dependencies. As a workaround
  90. // we forward declare boost::hash and include
  91. // the actual header later.
  92. //
  93. namespace boost{
  94. template <class T> struct hash;
  95. }
  96. namespace std{ namespace tr1{
  97. //using ::boost::hash;
  98. template <class T>
  99. struct hash : public boost::hash<T>
  100. {
  101. };
  102. }}
  103. #include <boost/functional/hash.hpp>
  104. #endif
  105. #endif