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 6 #ifndef BOOST_TR1_FUNCTIONAL_HPP_INCLUDED 7 # define BOOST_TR1_FUNCTIONAL_HPP_INCLUDED 8 # include <boost/tr1/detail/config.hpp> 9 # include <functional> 10 11 #if defined(BOOST_HAS_TR1_REFERENCE_WRAPPER) \ 12 || defined(BOOST_HAS_TR1_RESULT_OF)\ 13 || defined(BOOST_HAS_TR1_MEM_FN)\ 14 || defined(BOOST_HAS_TR1_BIND)\ 15 || defined(BOOST_HAS_TR1_FUNCTION)\ 16 || defined(BOOST_HAS_TR1_HASH) 17 # if defined(BOOST_HAS_INCLUDE_NEXT) && !defined(BOOST_TR1_DISABLE_INCLUDE_NEXT) 18 # include_next BOOST_TR1_HEADER(functional) 19 # else 20 # include <boost/tr1/detail/config_all.hpp> 21 # include BOOST_TR1_STD_HEADER(BOOST_TR1_PATH(functional)) 22 # endif 23 #endif 24 25 #ifndef BOOST_HAS_TR1_REFERENCE_WRAPPER 26 27 #include <boost/ref.hpp> 28 29 namespace std{ namespace tr1{ 30 31 using ::boost::reference_wrapper; 32 using ::boost::ref; 33 using ::boost::cref; 34 35 } } 36 37 #endif // BOOST_HAS_TR1_REFERENCE_WRAPPER 38 39 #if !defined(BOOST_HAS_TR1_RESULT_OF)\ 40 && !defined(BOOST_NO_SFINAE) && \ 41 !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) 42 43 // 44 // we can only actually include result_of.hpp if the compiler 45 // really does support it, otherwise we just get endless errors... 46 // 47 #include <boost/utility/result_of.hpp> 48 49 namespace std{ namespace tr1{ 50 51 template<class F> 52 struct result_of 53 : ::boost::tr1_result_of<F> 54 {}; 55 56 } } 57 58 #endif // BOOST_HAS_TR1_RESULT_OF 59 60 #ifndef BOOST_HAS_TR1_MEM_FN 61 // mem_fn: 62 #include <boost/mem_fn.hpp> 63 64 namespace std{ namespace tr1{ 65 66 using boost::mem_fn; 67 68 } } 69 70 #endif // BOOST_HAS_TR1_MEM_FN 71 72 73 #ifndef BOOST_HAS_TR1_BIND 74 // Bind: 75 #include <boost/bind.hpp> 76 77 namespace std{ namespace tr1{ 78 79 using ::boost::is_bind_expression; 80 using ::boost::is_placeholder; 81 using ::boost::bind; 82 namespace placeholders { 83 #ifndef BOOST_BIND_NO_PLACEHOLDERS 84 using ::_1; 85 using ::_2; 86 using ::_3; 87 using ::_4; 88 using ::_5; 89 using ::_6; 90 using ::_7; 91 using ::_8; 92 using ::_9; 93 #endif 94 } // placeholders 95 96 } } 97 98 #endif 99 100 #ifndef BOOST_HAS_TR1_FUNCTION 101 // polymorphic function object wrappers: 102 #include <boost/function.hpp> 103 #include <boost/detail/workaround.hpp> 104 105 #if !BOOST_WORKAROUND(__BORLANDC__, < 0x582) \ 106 && !BOOST_WORKAROUND(BOOST_MSVC, < 1310) \ 107 && !defined(BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX) 108 namespace std{ namespace tr1{ 109 110 using ::boost::bad_function_call; 111 using ::boost::function; 112 using ::boost::swap; 113 114 }} 115 #endif 116 117 #endif // BOOST_HAS_TR1_FUNCTION 118 119 #ifndef BOOST_HAS_TR1_HASH 120 // 121 // This header can get included by boost/hash.hpp 122 // leading to cyclic dependencies. As a workaround 123 // we forward declare boost::hash and include 124 // the actual header later. 125 // 126 namespace boost{ 127 template <class T> struct hash; 128 } 129 130 namespace std{ namespace tr1{ 131 //using ::boost::hash; 132 133 template <class T> 134 struct hash : public boost::hash<T> 135 { 136 }; 137 138 }} 139 140 #include <boost/functional/hash.hpp> 141 142 #endif 143 144 #endif 145 146