• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *     [begin_description]
3  *     Boost bind pull the placeholders, _1, _2, ... into global
4  *     namespace. This can conflict with the C++03 TR1 and C++11
5  *     std::placeholders. This header provides a workaround for
6  *     this problem.
7  *     [end_description]
8  *
9  *     Copyright 2012 Christoph Koke
10  *     Copyright 2012 Karsten Ahnert
11  *
12  *     Distributed under the Boost Software License, Version 1.0.
13  *     (See accompanying file LICENSE_1_0.txt or
14  *     copy at http://www.boost.org/LICENSE_1_0.txt)
15  * */
16 
17 #ifndef BOOST_NUMERIC_ODEINT_UTIL_BIND_HPP_INCLUDED
18 #define BOOST_NUMERIC_ODEINT_UTIL_BIND_HPP_INCLUDED
19 
20 
21 #include <boost/numeric/odeint/config.hpp>
22 
23 
24 #if BOOST_NUMERIC_ODEINT_CXX11
25     #include <functional>
26 #else
27 #define BOOST_BIND_NO_PLACEHOLDERS
28 #include <boost/bind.hpp>
29 #endif
30 
31 namespace boost {
32 namespace numeric {
33 namespace odeint {
34 namespace detail {
35 
36 #if BOOST_NUMERIC_ODEINT_CXX11
37 
38 using ::std::bind;
39 using namespace ::std::placeholders;
40 
41 
42 #else
43 
44 // unnamed namespace to avoid multiple declarations (#138)
45 namespace {
46 using ::boost::bind;
47 boost::arg<1> _1;
48 boost::arg<2> _2;
49 }
50 // using ::boost::bind;
51 // using ::_1;
52 // using ::_2;
53 
54 #endif
55 
56 }
57 }
58 }
59 }
60 
61 
62 
63 
64 
65 /*
66 
67 // the following is the suggested way. Unfortunately it does not work with all compilers.
68 
69 #ifdef BOOST_NO_CXX11_HDR_FUNCTIONAL
70 #include <boost/bind.hpp>
71 #else
72 #include <functional>
73 #endif
74 
75 
76 namespace boost {
77 namespace numeric {
78 namespace odeint {
79 namespace detail {
80 
81 
82 #ifdef BOOST_NO_CXX11_HDR_FUNCTIONAL
83 
84 using ::boost::bind;
85 using ::_1;
86 using ::_2;
87 
88 #else
89 
90 using ::std::bind;
91 using namespace ::std::placeholders;
92 
93 #endif
94 
95 
96 }
97 }
98 }
99 }*/
100 
101 #endif // BOOST_NUMERIC_ODEINT_UTIL_BIND_HPP_INCLUDED
102