in_place_factory.hpp
Go to the documentation of this file.
1 // Copyright (C) 2003, Fernando Luis Cacciola Carballal.
2 // Copyright (C) 2007, Tobias Schwinger.
3 //
4 // Use, modification, and distribution is subject to the Boost Software
5 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
7 //
8 // See http://www.boost.org/libs/optional for documentation.
9 //
10 // You are welcome to contact the author at:
11 // fernando_cacciola@hotmail.com
12 //
13 #ifndef BOOST_UTILITY_INPLACE_FACTORY_04APR2007_HPP
14 #ifndef BOOST_PP_IS_ITERATING
15 
17 
18 namespace boost {
19 
21 
22 #define BOOST_PP_ITERATION_LIMITS (0, BOOST_MAX_INPLACE_FACTORY_ARITY)
23 #define BOOST_PP_FILENAME_1 <boost/utility/in_place_factory.hpp>
24 #include BOOST_PP_ITERATE()
25 
26 } // namespace boost
27 
29 
30 #define BOOST_UTILITY_INPLACE_FACTORY_04APR2007_HPP
31 #else
32 #define N BOOST_PP_ITERATION()
33 
34 #if N
35 template< BOOST_PP_ENUM_PARAMS(N, class A) >
36 #endif
37 class BOOST_PP_CAT(in_place_factory,N)
38  :
39  public in_place_factory_base
40 {
41 public:
42 
43  explicit BOOST_PP_CAT(in_place_factory,N)
44  ( BOOST_PP_ENUM_BINARY_PARAMS(N,A,const& a) )
45 #if N > 0
47 #endif
48  {}
49 
50  template<class T>
51  void* apply(void* address) const
52  {
53  return new(address) T( BOOST_PP_ENUM_PARAMS(N, m_a) );
54  }
55 
56  template<class T>
57  void* apply(void* address, std::size_t n) const
58  {
59  for(char* next = address = this->BOOST_NESTED_TEMPLATE apply<T>(address);
60  !! --n;)
61  this->BOOST_NESTED_TEMPLATE apply<T>(next = next+sizeof(T));
62  return address;
63  }
64 
66 };
67 
68 #if N > 0
69 template< BOOST_PP_ENUM_PARAMS(N, class A) >
70 inline BOOST_PP_CAT(in_place_factory,N)< BOOST_PP_ENUM_PARAMS(N, A) >
71 in_place( BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& a) )
72 {
73  return BOOST_PP_CAT(in_place_factory,N)< BOOST_PP_ENUM_PARAMS(N, A) >
74  ( BOOST_PP_ENUM_PARAMS(N, a) );
75 }
76 #else
77 inline in_place_factory0 in_place()
78 {
79  return in_place_factory0();
80 }
81 #endif
82 
83 #undef N
84 #endif
85 #endif
86 
#define BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_DECL(z, n, _)
BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE.
GLdouble n
Definition: glext.h:1966
GLboolean GLboolean GLboolean GLboolean a
#define BOOST_PP_ENUM_BINARY_PARAMS(count, p1, p2)
#define BOOST_PP_REPEAT
#define BOOST_PP_CAT(a, b)
Definition: cat.hpp:22
#define BOOST_PP_ENUM
#define BOOST_PP_ENUM_PARAMS(count, param)
GLuint GLuint64EXT address
Definition: glext.h:11417
T next(T x)
Definition: next_prior.hpp:146
#define BOOST_NESTED_TEMPLATE
Definition: suffix.hpp:437
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN typedef arg< -1 > _
#define BOOST_DEFINE_INPLACE_FACTORY_CLASS_MEMBER_INIT(z, n, _)


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:47:17