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