Chris@16
|
1 /*
|
Chris@101
|
2 * Copyright Andrey Semashev 2007 - 2015.
|
Chris@16
|
3 * Distributed under the Boost Software License, Version 1.0.
|
Chris@16
|
4 * (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
5 * http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
6 */
|
Chris@16
|
7
|
Chris@16
|
8 template<
|
Chris@16
|
9 typename ResultT
|
Chris@16
|
10 BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), typename ArgT)
|
Chris@16
|
11 >
|
Chris@16
|
12 class light_function< ResultT (BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), ArgT)) >
|
Chris@16
|
13 {
|
Chris@16
|
14 typedef light_function this_type;
|
Chris@16
|
15 BOOST_COPYABLE_AND_MOVABLE(this_type)
|
Chris@16
|
16
|
Chris@16
|
17 public:
|
Chris@16
|
18 typedef ResultT result_type;
|
Chris@16
|
19
|
Chris@16
|
20 private:
|
Chris@16
|
21 struct impl_base
|
Chris@16
|
22 {
|
Chris@101
|
23 typedef result_type (*invoke_type)(void* BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), ArgT));
|
Chris@16
|
24 const invoke_type invoke;
|
Chris@16
|
25
|
Chris@101
|
26 typedef impl_base* (*clone_type)(const void*);
|
Chris@16
|
27 const clone_type clone;
|
Chris@16
|
28
|
Chris@101
|
29 typedef void (*destroy_type)(void*);
|
Chris@16
|
30 const destroy_type destroy;
|
Chris@16
|
31
|
Chris@16
|
32 impl_base(invoke_type inv, clone_type cl, destroy_type dstr) : invoke(inv), clone(cl), destroy(dstr)
|
Chris@16
|
33 {
|
Chris@16
|
34 }
|
Chris@101
|
35
|
Chris@101
|
36 BOOST_DELETED_FUNCTION(impl_base(impl_base const&))
|
Chris@101
|
37 BOOST_DELETED_FUNCTION(impl_base& operator= (impl_base const&))
|
Chris@16
|
38 };
|
Chris@16
|
39
|
Chris@16
|
40 #if !defined(BOOST_LOG_NO_MEMBER_TEMPLATE_FRIENDS)
|
Chris@16
|
41 template< typename FunT >
|
Chris@16
|
42 class impl;
|
Chris@16
|
43 template< typename FunT >
|
Chris@16
|
44 friend class impl;
|
Chris@16
|
45 #endif
|
Chris@16
|
46
|
Chris@16
|
47 template< typename FunT >
|
Chris@16
|
48 class impl :
|
Chris@16
|
49 public impl_base
|
Chris@16
|
50 {
|
Chris@16
|
51 typedef impl< FunT > this_type;
|
Chris@16
|
52
|
Chris@16
|
53 FunT m_Function;
|
Chris@16
|
54
|
Chris@16
|
55 public:
|
Chris@16
|
56 explicit impl(FunT const& fun) :
|
Chris@16
|
57 impl_base(&this_type::invoke_impl, &this_type::clone_impl, &this_type::destroy_impl),
|
Chris@16
|
58 m_Function(fun)
|
Chris@16
|
59 {
|
Chris@16
|
60 }
|
Chris@16
|
61
|
Chris@16
|
62 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
Chris@16
|
63 explicit impl(FunT&& fun) :
|
Chris@16
|
64 impl_base(&this_type::invoke_impl, &this_type::clone_impl, &this_type::destroy_impl),
|
Chris@101
|
65 m_Function(boost::move(fun))
|
Chris@16
|
66 {
|
Chris@16
|
67 }
|
Chris@16
|
68 #endif // !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
Chris@16
|
69
|
Chris@101
|
70 static void destroy_impl(void* self)
|
Chris@16
|
71 {
|
Chris@101
|
72 delete static_cast< impl* >(static_cast< impl_base* >(self));
|
Chris@16
|
73 }
|
Chris@101
|
74 static impl_base* clone_impl(const void* self)
|
Chris@16
|
75 {
|
Chris@101
|
76 return new impl(static_cast< const impl* >(static_cast< const impl_base* >(self))->m_Function);
|
Chris@16
|
77 }
|
Chris@101
|
78 static result_type invoke_impl(void* self BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(BOOST_PP_ITERATION(), ArgT, arg))
|
Chris@16
|
79 {
|
Chris@101
|
80 return static_cast< impl* >(static_cast< impl_base* >(self))->m_Function(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), arg));
|
Chris@16
|
81 }
|
Chris@101
|
82
|
Chris@101
|
83 BOOST_DELETED_FUNCTION(impl(impl const&))
|
Chris@101
|
84 BOOST_DELETED_FUNCTION(impl& operator= (impl const&))
|
Chris@16
|
85 };
|
Chris@16
|
86
|
Chris@16
|
87 private:
|
Chris@16
|
88 impl_base* m_pImpl;
|
Chris@16
|
89
|
Chris@16
|
90 public:
|
Chris@16
|
91 BOOST_CONSTEXPR light_function() BOOST_NOEXCEPT : m_pImpl(NULL)
|
Chris@16
|
92 {
|
Chris@16
|
93 }
|
Chris@16
|
94 light_function(this_type const& that)
|
Chris@16
|
95 {
|
Chris@16
|
96 if (that.m_pImpl)
|
Chris@16
|
97 m_pImpl = that.m_pImpl->clone(that.m_pImpl);
|
Chris@16
|
98 else
|
Chris@16
|
99 m_pImpl = NULL;
|
Chris@16
|
100 }
|
Chris@16
|
101
|
Chris@16
|
102 light_function(BOOST_RV_REF(this_type) that) BOOST_NOEXCEPT
|
Chris@16
|
103 {
|
Chris@16
|
104 m_pImpl = that.m_pImpl;
|
Chris@16
|
105 that.m_pImpl = NULL;
|
Chris@16
|
106 }
|
Chris@16
|
107
|
Chris@16
|
108 light_function(BOOST_RV_REF(const this_type) that) BOOST_NOEXCEPT
|
Chris@16
|
109 {
|
Chris@16
|
110 m_pImpl = that.m_pImpl;
|
Chris@16
|
111 ((this_type&)that).m_pImpl = NULL;
|
Chris@16
|
112 }
|
Chris@16
|
113
|
Chris@16
|
114 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
Chris@16
|
115 template< typename FunT >
|
Chris@16
|
116 light_function(FunT&& fun) :
|
Chris@16
|
117 m_pImpl(new impl< typename remove_cv< typename remove_reference< FunT >::type >::type >(boost::forward< FunT >(fun)))
|
Chris@16
|
118 {
|
Chris@16
|
119 }
|
Chris@16
|
120 #else
|
Chris@16
|
121 template< typename FunT >
|
Chris@101
|
122 light_function(FunT const& fun, typename disable_if_c< is_rv_or_same< FunT, this_type >::value, int >::type = 0) :
|
Chris@16
|
123 m_pImpl(new impl< FunT >(fun))
|
Chris@16
|
124 {
|
Chris@16
|
125 }
|
Chris@16
|
126 template< typename FunT >
|
Chris@101
|
127 light_function(BOOST_RV_REF(FunT) fun, typename disable_if_c< is_cv_same< FunT, this_type >::value, int >::type = 0) :
|
Chris@16
|
128 m_pImpl(new impl< typename remove_cv< FunT >::type >(fun))
|
Chris@16
|
129 {
|
Chris@16
|
130 }
|
Chris@16
|
131 #endif
|
Chris@16
|
132
|
Chris@16
|
133 //! Constructor from NULL
|
Chris@16
|
134 #if !defined(BOOST_NO_CXX11_NULLPTR)
|
Chris@16
|
135 BOOST_CONSTEXPR light_function(std::nullptr_t) BOOST_NOEXCEPT
|
Chris@16
|
136 #else
|
Chris@16
|
137 BOOST_CONSTEXPR light_function(int p) BOOST_NOEXCEPT
|
Chris@16
|
138 #endif
|
Chris@16
|
139 : m_pImpl(NULL)
|
Chris@16
|
140 {
|
Chris@16
|
141 #if defined(BOOST_NO_CXX11_NULLPTR)
|
Chris@16
|
142 BOOST_ASSERT(p == 0);
|
Chris@16
|
143 #endif
|
Chris@16
|
144 }
|
Chris@16
|
145 ~light_function()
|
Chris@16
|
146 {
|
Chris@16
|
147 clear();
|
Chris@16
|
148 }
|
Chris@16
|
149
|
Chris@16
|
150 light_function& operator= (BOOST_RV_REF(this_type) that) BOOST_NOEXCEPT
|
Chris@16
|
151 {
|
Chris@16
|
152 this->swap(that);
|
Chris@16
|
153 return *this;
|
Chris@16
|
154 }
|
Chris@16
|
155 light_function& operator= (BOOST_COPY_ASSIGN_REF(this_type) that)
|
Chris@16
|
156 {
|
Chris@101
|
157 light_function tmp = static_cast< this_type const& >(that);
|
Chris@16
|
158 this->swap(tmp);
|
Chris@16
|
159 return *this;
|
Chris@16
|
160 }
|
Chris@16
|
161 //! Assignment of NULL
|
Chris@16
|
162 #if !defined(BOOST_NO_CXX11_NULLPTR)
|
Chris@16
|
163 light_function& operator= (std::nullptr_t)
|
Chris@16
|
164 #else
|
Chris@16
|
165 light_function& operator= (int p)
|
Chris@16
|
166 #endif
|
Chris@16
|
167 {
|
Chris@16
|
168 #if defined(BOOST_NO_CXX11_NULLPTR)
|
Chris@16
|
169 BOOST_ASSERT(p == 0);
|
Chris@16
|
170 #endif
|
Chris@16
|
171 clear();
|
Chris@16
|
172 return *this;
|
Chris@16
|
173 }
|
Chris@16
|
174 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
Chris@16
|
175 template< typename FunT >
|
Chris@16
|
176 light_function& operator= (FunT&& fun)
|
Chris@16
|
177 {
|
Chris@16
|
178 light_function tmp(boost::forward< FunT >(fun));
|
Chris@16
|
179 this->swap(tmp);
|
Chris@16
|
180 return *this;
|
Chris@16
|
181 }
|
Chris@16
|
182 #else
|
Chris@16
|
183 template< typename FunT >
|
Chris@101
|
184 typename disable_if_c< is_rv_or_same< FunT, this_type >::value, this_type& >::type
|
Chris@16
|
185 operator= (FunT const& fun)
|
Chris@16
|
186 {
|
Chris@16
|
187 light_function tmp(fun);
|
Chris@16
|
188 this->swap(tmp);
|
Chris@16
|
189 return *this;
|
Chris@16
|
190 }
|
Chris@16
|
191 #endif
|
Chris@16
|
192
|
Chris@16
|
193 result_type operator() (BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_ITERATION(), ArgT, arg)) const
|
Chris@16
|
194 {
|
Chris@16
|
195 return m_pImpl->invoke(m_pImpl BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), arg));
|
Chris@16
|
196 }
|
Chris@16
|
197
|
Chris@101
|
198 BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT()
|
Chris@16
|
199 bool operator! () const BOOST_NOEXCEPT { return (m_pImpl == NULL); }
|
Chris@16
|
200 bool empty() const BOOST_NOEXCEPT { return (m_pImpl == NULL); }
|
Chris@16
|
201 void clear() BOOST_NOEXCEPT
|
Chris@16
|
202 {
|
Chris@16
|
203 if (m_pImpl)
|
Chris@16
|
204 {
|
Chris@16
|
205 m_pImpl->destroy(m_pImpl);
|
Chris@16
|
206 m_pImpl = NULL;
|
Chris@16
|
207 }
|
Chris@16
|
208 }
|
Chris@16
|
209
|
Chris@16
|
210 void swap(this_type& that) BOOST_NOEXCEPT
|
Chris@16
|
211 {
|
Chris@101
|
212 impl_base* p = m_pImpl;
|
Chris@16
|
213 m_pImpl = that.m_pImpl;
|
Chris@16
|
214 that.m_pImpl = p;
|
Chris@16
|
215 }
|
Chris@16
|
216 };
|
Chris@16
|
217
|
Chris@16
|
218 template<
|
Chris@16
|
219 BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), typename ArgT)
|
Chris@16
|
220 >
|
Chris@16
|
221 class light_function< void (BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), ArgT)) >
|
Chris@16
|
222 {
|
Chris@16
|
223 typedef light_function this_type;
|
Chris@16
|
224 BOOST_COPYABLE_AND_MOVABLE(this_type)
|
Chris@16
|
225
|
Chris@16
|
226 public:
|
Chris@16
|
227 typedef void result_type;
|
Chris@16
|
228
|
Chris@16
|
229 private:
|
Chris@16
|
230 struct impl_base
|
Chris@16
|
231 {
|
Chris@101
|
232 typedef void (*invoke_type)(void* BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), ArgT));
|
Chris@16
|
233 const invoke_type invoke;
|
Chris@16
|
234
|
Chris@101
|
235 typedef impl_base* (*clone_type)(const void*);
|
Chris@16
|
236 const clone_type clone;
|
Chris@16
|
237
|
Chris@101
|
238 typedef void (*destroy_type)(void*);
|
Chris@16
|
239 const destroy_type destroy;
|
Chris@16
|
240
|
Chris@16
|
241 impl_base(invoke_type inv, clone_type cl, destroy_type dstr) : invoke(inv), clone(cl), destroy(dstr)
|
Chris@16
|
242 {
|
Chris@16
|
243 }
|
Chris@101
|
244
|
Chris@101
|
245 BOOST_DELETED_FUNCTION(impl_base(impl_base const&))
|
Chris@101
|
246 BOOST_DELETED_FUNCTION(impl_base& operator= (impl_base const&))
|
Chris@16
|
247 };
|
Chris@16
|
248
|
Chris@16
|
249 #if !defined(BOOST_LOG_NO_MEMBER_TEMPLATE_FRIENDS)
|
Chris@16
|
250 template< typename FunT >
|
Chris@16
|
251 class impl;
|
Chris@16
|
252 template< typename FunT >
|
Chris@16
|
253 friend class impl;
|
Chris@16
|
254 #endif
|
Chris@16
|
255
|
Chris@16
|
256 template< typename FunT >
|
Chris@16
|
257 class impl :
|
Chris@16
|
258 public impl_base
|
Chris@16
|
259 {
|
Chris@16
|
260 typedef impl< FunT > this_type;
|
Chris@16
|
261
|
Chris@16
|
262 FunT m_Function;
|
Chris@16
|
263
|
Chris@16
|
264 public:
|
Chris@16
|
265 explicit impl(FunT const& fun) :
|
Chris@16
|
266 impl_base(&this_type::invoke_impl, &this_type::clone_impl, &this_type::destroy_impl),
|
Chris@16
|
267 m_Function(fun)
|
Chris@16
|
268 {
|
Chris@16
|
269 }
|
Chris@16
|
270
|
Chris@16
|
271 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
Chris@16
|
272 explicit impl(FunT&& fun) :
|
Chris@16
|
273 impl_base(&this_type::invoke_impl, &this_type::clone_impl, &this_type::destroy_impl),
|
Chris@101
|
274 m_Function(boost::move(fun))
|
Chris@16
|
275 {
|
Chris@16
|
276 }
|
Chris@16
|
277 #endif // !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
Chris@16
|
278
|
Chris@101
|
279 static void destroy_impl(void* self)
|
Chris@16
|
280 {
|
Chris@101
|
281 delete static_cast< impl* >(static_cast< impl_base* >(self));
|
Chris@16
|
282 }
|
Chris@101
|
283 static impl_base* clone_impl(const void* self)
|
Chris@16
|
284 {
|
Chris@101
|
285 return new impl(static_cast< const impl* >(static_cast< const impl_base* >(self))->m_Function);
|
Chris@16
|
286 }
|
Chris@101
|
287 static result_type invoke_impl(void* self BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(BOOST_PP_ITERATION(), ArgT, arg))
|
Chris@16
|
288 {
|
Chris@101
|
289 static_cast< impl* >(static_cast< impl_base* >(self))->m_Function(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), arg));
|
Chris@16
|
290 }
|
Chris@101
|
291
|
Chris@101
|
292 BOOST_DELETED_FUNCTION(impl(impl const&))
|
Chris@101
|
293 BOOST_DELETED_FUNCTION(impl& operator= (impl const&))
|
Chris@16
|
294 };
|
Chris@16
|
295
|
Chris@16
|
296 private:
|
Chris@16
|
297 impl_base* m_pImpl;
|
Chris@16
|
298
|
Chris@16
|
299 public:
|
Chris@16
|
300 BOOST_CONSTEXPR light_function() BOOST_NOEXCEPT : m_pImpl(NULL)
|
Chris@16
|
301 {
|
Chris@16
|
302 }
|
Chris@16
|
303 light_function(this_type const& that)
|
Chris@16
|
304 {
|
Chris@16
|
305 if (that.m_pImpl)
|
Chris@16
|
306 m_pImpl = that.m_pImpl->clone(that.m_pImpl);
|
Chris@16
|
307 else
|
Chris@16
|
308 m_pImpl = NULL;
|
Chris@16
|
309 }
|
Chris@16
|
310 light_function(BOOST_RV_REF(this_type) that) BOOST_NOEXCEPT
|
Chris@16
|
311 {
|
Chris@16
|
312 m_pImpl = that.m_pImpl;
|
Chris@16
|
313 that.m_pImpl = NULL;
|
Chris@16
|
314 }
|
Chris@16
|
315
|
Chris@16
|
316 light_function(BOOST_RV_REF(const this_type) that) BOOST_NOEXCEPT
|
Chris@16
|
317 {
|
Chris@16
|
318 m_pImpl = that.m_pImpl;
|
Chris@16
|
319 ((this_type&)that).m_pImpl = NULL;
|
Chris@16
|
320 }
|
Chris@16
|
321
|
Chris@16
|
322 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
Chris@16
|
323 template< typename FunT >
|
Chris@16
|
324 light_function(FunT&& fun) :
|
Chris@16
|
325 m_pImpl(new impl< typename remove_cv< typename remove_reference< FunT >::type >::type >(boost::forward< FunT >(fun)))
|
Chris@16
|
326 {
|
Chris@16
|
327 }
|
Chris@16
|
328 #else
|
Chris@16
|
329 template< typename FunT >
|
Chris@101
|
330 light_function(FunT const& fun, typename disable_if_c< is_rv_or_same< FunT, this_type >::value, int >::type = 0) :
|
Chris@16
|
331 m_pImpl(new impl< FunT >(fun))
|
Chris@16
|
332 {
|
Chris@16
|
333 }
|
Chris@16
|
334 template< typename FunT >
|
Chris@101
|
335 light_function(BOOST_RV_REF(FunT) fun, typename disable_if_c< is_cv_same< FunT, this_type >::value, int >::type = 0) :
|
Chris@16
|
336 m_pImpl(new impl< typename remove_cv< FunT >::type >(fun))
|
Chris@16
|
337 {
|
Chris@16
|
338 }
|
Chris@16
|
339 #endif
|
Chris@16
|
340
|
Chris@16
|
341 //! Constructor from NULL
|
Chris@16
|
342 #if !defined(BOOST_NO_CXX11_NULLPTR)
|
Chris@16
|
343 BOOST_CONSTEXPR light_function(std::nullptr_t) BOOST_NOEXCEPT
|
Chris@16
|
344 #else
|
Chris@16
|
345 BOOST_CONSTEXPR light_function(int p) BOOST_NOEXCEPT
|
Chris@16
|
346 #endif
|
Chris@16
|
347 : m_pImpl(NULL)
|
Chris@16
|
348 {
|
Chris@16
|
349 #if defined(BOOST_NO_CXX11_NULLPTR)
|
Chris@16
|
350 BOOST_ASSERT(p == 0);
|
Chris@16
|
351 #endif
|
Chris@16
|
352 }
|
Chris@16
|
353 ~light_function()
|
Chris@16
|
354 {
|
Chris@16
|
355 clear();
|
Chris@16
|
356 }
|
Chris@16
|
357
|
Chris@16
|
358 light_function& operator= (BOOST_RV_REF(this_type) that) BOOST_NOEXCEPT
|
Chris@16
|
359 {
|
Chris@16
|
360 this->swap(that);
|
Chris@16
|
361 return *this;
|
Chris@16
|
362 }
|
Chris@16
|
363 light_function& operator= (BOOST_COPY_ASSIGN_REF(this_type) that)
|
Chris@16
|
364 {
|
Chris@101
|
365 light_function tmp = static_cast< this_type const& >(that);
|
Chris@16
|
366 this->swap(tmp);
|
Chris@16
|
367 return *this;
|
Chris@16
|
368 }
|
Chris@16
|
369 //! Assignment of NULL
|
Chris@16
|
370 #if !defined(BOOST_NO_CXX11_NULLPTR)
|
Chris@16
|
371 light_function& operator= (std::nullptr_t)
|
Chris@16
|
372 #else
|
Chris@16
|
373 light_function& operator= (int p)
|
Chris@16
|
374 #endif
|
Chris@16
|
375 {
|
Chris@16
|
376 #if defined(BOOST_NO_CXX11_NULLPTR)
|
Chris@16
|
377 BOOST_ASSERT(p == 0);
|
Chris@16
|
378 #endif
|
Chris@16
|
379 clear();
|
Chris@16
|
380 return *this;
|
Chris@16
|
381 }
|
Chris@16
|
382 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
Chris@16
|
383 template< typename FunT >
|
Chris@16
|
384 light_function& operator= (FunT&& fun)
|
Chris@16
|
385 {
|
Chris@16
|
386 light_function tmp(boost::forward< FunT >(fun));
|
Chris@16
|
387 this->swap(tmp);
|
Chris@16
|
388 return *this;
|
Chris@16
|
389 }
|
Chris@16
|
390 #else
|
Chris@16
|
391 template< typename FunT >
|
Chris@101
|
392 typename disable_if_c< is_rv_or_same< FunT, this_type >::value, this_type& >::type
|
Chris@16
|
393 operator= (FunT const& fun)
|
Chris@16
|
394 {
|
Chris@16
|
395 light_function tmp(fun);
|
Chris@16
|
396 this->swap(tmp);
|
Chris@16
|
397 return *this;
|
Chris@16
|
398 }
|
Chris@16
|
399 #endif
|
Chris@16
|
400
|
Chris@16
|
401 result_type operator() (BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_ITERATION(), ArgT, arg)) const
|
Chris@16
|
402 {
|
Chris@16
|
403 m_pImpl->invoke(m_pImpl BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), arg));
|
Chris@16
|
404 }
|
Chris@16
|
405
|
Chris@101
|
406 BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT()
|
Chris@16
|
407 bool operator! () const BOOST_NOEXCEPT { return (m_pImpl == NULL); }
|
Chris@16
|
408 bool empty() const BOOST_NOEXCEPT { return (m_pImpl == NULL); }
|
Chris@16
|
409 void clear() BOOST_NOEXCEPT
|
Chris@16
|
410 {
|
Chris@16
|
411 if (m_pImpl)
|
Chris@16
|
412 {
|
Chris@16
|
413 m_pImpl->destroy(m_pImpl);
|
Chris@16
|
414 m_pImpl = NULL;
|
Chris@16
|
415 }
|
Chris@16
|
416 }
|
Chris@16
|
417
|
Chris@16
|
418 void swap(this_type& that) BOOST_NOEXCEPT
|
Chris@16
|
419 {
|
Chris@101
|
420 impl_base* p = m_pImpl;
|
Chris@16
|
421 m_pImpl = that.m_pImpl;
|
Chris@16
|
422 that.m_pImpl = p;
|
Chris@16
|
423 }
|
Chris@16
|
424 };
|