aligned_storage.hpp
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 // boost aligned_storage.hpp header file
3 // See http://www.boost.org for updates, documentation, and revision history.
4 //-----------------------------------------------------------------------------
5 //
6 // Copyright (c) 2002-2003
7 // Eric Friedman, Itay Maman
8 //
9 // Distributed under the Boost Software License, Version 1.0. (See
10 // accompanying file LICENSE_1_0.txt or copy at
11 // http://www.boost.org/LICENSE_1_0.txt)
12 
13 #ifndef BOOST_TT_ALIGNED_STORAGE_HPP
14 #define BOOST_TT_ALIGNED_STORAGE_HPP
15 
16 #include <cstddef> // for std::size_t
17 
18 #include <boost/config.hpp>
24 
25 namespace boost {
26 
27 namespace detail { namespace aligned_storage {
28 
30  std::size_t
31  , alignment_of_max_align = ::boost::alignment_of<boost::detail::max_align>::value
32  );
33 
34 //
35 // To be TR1 conforming this must be a POD type:
36 //
37 template <
38  std::size_t size_
39  , std::size_t alignment_
40 >
42 {
43  union data_t
44  {
45  char buf[size_];
46 
48  } data_;
49  void* address() const { return const_cast<aligned_storage_imp*>(this); }
50 };
51 template <std::size_t size>
53 {
54  union data_t
55  {
56  char buf[size];
58  } data_;
59  void* address() const { return const_cast<aligned_storage_imp*>(this); }
60 };
61 
62 template< std::size_t alignment_ >
63 struct aligned_storage_imp<0u,alignment_>
64 {
65  /* intentionally empty */
66  void* address() const { return 0; }
67 };
68 
69 }} // namespace detail::aligned_storage
70 
71 template <
72  std::size_t size_
73  , std::size_t alignment_ = std::size_t(-1)
74 >
76 #ifndef __BORLANDC__
77  private
78 #else
79  public
80 #endif
82 {
83 
84 public: // constants
85 
86  typedef ::boost::detail::aligned_storage::aligned_storage_imp<size_, alignment_> type;
87 
89  std::size_t
90  , size = size_
91  );
93  std::size_t
94  , alignment = (
95  alignment_ == std::size_t(-1)
96  ? ::boost::detail::aligned_storage::alignment_of_max_align
97  : alignment_
98  )
99  );
100 
101 private: // noncopyable
102 
104  aligned_storage& operator=(const aligned_storage&);
105 
106 public: // structors
107 
109  {
110  }
111 
113  {
114  }
115 
116 public: // accessors
117 
118  void* address()
119  {
120  return static_cast<type*>(this)->address();
121  }
122 
123  const void* address() const
124  {
125  return static_cast<const type*>(this)->address();
126  }
127 };
128 
129 //
130 // Make sure that is_pod recognises aligned_storage<>::type
131 // as a POD (Note that aligned_storage<> itself is not a POD):
132 //
133 template <std::size_t size_, std::size_t alignment_>
134 struct is_pod< ::boost::detail::aligned_storage::aligned_storage_imp<size_, alignment_> > : public true_type{};
135 
136 } // namespace boost
137 
138 #endif // BOOST_ALIGNED_STORAGE_HPP
union boost::detail::aligned_storage::aligned_storage_imp::data_t data_
BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE.
BOOST_STATIC_CONSTANT(std::size_t, alignment_of_max_align=::boost::alignment_of< boost::detail::max_align >::value)
typename ::boost::type_with_alignment< alignment_ >::type align_
::boost::detail::aligned_storage::aligned_storage_imp< size_, alignment_ > type
GLenum GLuint GLenum GLsizei const GLchar * buf
const void * address() const
GLsizeiptr size
detail namespace with internal helper functions
Definition: json.hpp:269
GLenum type


librealsense2
Author(s): LibRealSense ROS Team
autogenerated on Thu Dec 22 2022 03:41:41