Loading [MathJax]/extensions/TeX/AMSsymbols.js
 Reference documentation for deal.II version 8.5.1
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
bind.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2009 - 2014 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE at
12 // the top level of the deal.II distribution.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii__std_cxx11_bind_h
17 #define dealii__std_cxx11_bind_h
18 
19 
20 #include <deal.II/base/config.h>
21 
22 #ifdef DEAL_II_WITH_CXX11
23 
24 # include <functional>
25 
26 DEAL_II_NAMESPACE_OPEN
27 // In boost, the placeholders _1, _2, ... are in the global namespace. In
28 // C++11, they are in namespace std::placeholders, which makes them awkward to
29 // use. Import them into the ::std_cxx11 namespace instead and do them
30 // same below if we use boost instead. Namespace 'placeholders' is also defined
31 // in ::std_cxx11 namespace to make code C++ standard compatible.
32 // That is to say, if std::something works with C++11 standard,
33 // then ::std_cxx11::something should also work.
34 namespace std_cxx11
35 {
36  using namespace std::placeholders;
37  using std::bind;
38  using std::ref;
39  using std::cref;
40  using std::reference_wrapper;
41 
42  namespace placeholders = std::placeholders;
43 }
44 DEAL_II_NAMESPACE_CLOSE
45 
46 #else
47 
48 #include <boost/bind.hpp>
49 
50 DEAL_II_NAMESPACE_OPEN
51 namespace std_cxx11
52 {
53  using boost::bind;
54  using boost::ref;
55  using boost::cref;
56  using boost::reference_wrapper;
57 
58  // now also import the _1, _2 placeholders from the global namespace
59  // into the current one as suggested above
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 
70  namespace placeholders
71  {
72  using ::_1;
73  using ::_2;
74  using ::_3;
75  using ::_4;
76  using ::_5;
77  using ::_6;
78  using ::_7;
79  using ::_8;
80  using ::_9;
81  }
82 }
83 DEAL_II_NAMESPACE_CLOSE
84 
85 #endif
86 
87 // then allow using the old namespace name instead of the new one
88 DEAL_II_NAMESPACE_OPEN
89 namespace std_cxx1x = std_cxx11;
90 DEAL_II_NAMESPACE_CLOSE
91 
92 #endif