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 
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    template<class F>
51    struct result_of
52      : ::boost::tr1_result_of<F>
53    {};
54 
55 } }
56 
57 #endif // BOOST_HAS_TR1_RESULT_OF
58 
59 #ifndef BOOST_HAS_TR1_MEM_FN
60 // mem_fn:
61 #include <boost/mem_fn.hpp>
62 
63 namespace std{ namespace tr1{
64 
65 using boost::mem_fn;
66 
67 } }
68 
69 #endif // BOOST_HAS_TR1_MEM_FN
70 
71 
72 #ifndef BOOST_HAS_TR1_BIND
73 // Bind:
74 #include <boost/bind.hpp>
75 
76 namespace std{ namespace tr1{
77 
78    using ::boost::is_bind_expression;
79    using ::boost::is_placeholder;
80    using ::boost::bind;
81    namespace placeholders {
82 #ifndef BOOST_BIND_NO_PLACEHOLDERS
83       using ::_1;
84       using ::_2;
85       using ::_3;
86       using ::_4;
87       using ::_5;
88       using ::_6;
89       using ::_7;
90       using ::_8;
91       using ::_9;
92 #endif
93    } // placeholders
94 
95 } }
96 
97 #endif
98 
99 #ifndef BOOST_HAS_TR1_FUNCTION
100 // polymorphic function object wrappers:
101 #include <boost/function.hpp>
102 #include <boost/detail/workaround.hpp>
103 
104 #if !BOOST_WORKAROUND(__BORLANDC__, < 0x582) \
105     && !defined(BOOST_FUNCTION_NO_FUNCTION_TYPE_SYNTAX)
106 namespace std{ namespace tr1{
107 
108    using ::boost::bad_function_call;
109    using ::boost::function;
110    using ::boost::swap;
111 
112 }}
113 #endif
114 
115 #endif // BOOST_HAS_TR1_FUNCTION
116 
117 #ifndef BOOST_HAS_TR1_HASH
118 //
119 // This header can get included by boost/hash.hpp
120 // leading to cyclic dependencies.  As a workaround
121 // we forward declare boost::hash and include
122 // the actual header later.
123 //
124 namespace boost{
125 template <class T> struct hash;
126 }
127 
128 namespace std{ namespace tr1{
129    //using ::boost::hash;
130 
131    template <class T>
132    struct hash : public boost::hash<T>
133    {
134    };
135 
136 }}
137 
138 #include <boost/functional/hash.hpp>
139 
140 #endif
141 
142 #endif
143 
144