[857] | 1 | // Copyright David Abrahams 2002.
|
---|
| 2 | // Distributed under the Boost Software License, Version 1.0. (See
|
---|
| 3 | // accompanying file LICENSE_1_0.txt or copy at
|
---|
| 4 | // http://www.boost.org/LICENSE_1_0.txt)
|
---|
| 5 | #ifndef CONSTRUCT_REFERENCE_DWA2002716_HPP
|
---|
| 6 | # define CONSTRUCT_REFERENCE_DWA2002716_HPP
|
---|
| 7 |
|
---|
| 8 | namespace boost { namespace python { namespace detail {
|
---|
| 9 |
|
---|
| 10 | template <class T, class Arg>
|
---|
| 11 | void construct_pointee(void* storage, Arg& x
|
---|
| 12 | # if !defined(BOOST_MSVC) || BOOST_MSVC > 1300
|
---|
| 13 | , T const volatile*
|
---|
| 14 | # else
|
---|
| 15 | , T const*
|
---|
| 16 | # endif
|
---|
| 17 | )
|
---|
| 18 | {
|
---|
| 19 | new (storage) T(x);
|
---|
| 20 | }
|
---|
| 21 |
|
---|
| 22 | template <class T, class Arg>
|
---|
| 23 | void construct_referent_impl(void* storage, Arg& x, T&(*)())
|
---|
| 24 | {
|
---|
| 25 | construct_pointee(storage, x, (T*)0);
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | template <class T, class Arg>
|
---|
| 29 | void construct_referent(void* storage, Arg const& x, T(*tag)() = 0)
|
---|
| 30 | {
|
---|
| 31 | construct_referent_impl(storage, x, tag);
|
---|
| 32 | }
|
---|
| 33 |
|
---|
| 34 | template <class T, class Arg>
|
---|
| 35 | void construct_referent(void* storage, Arg& x, T(*tag)() = 0)
|
---|
| 36 | {
|
---|
| 37 | construct_referent_impl(storage, x, tag);
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | }}} // namespace boost::python::detail
|
---|
| 41 |
|
---|
| 42 | #endif // CONSTRUCT_REFERENCE_DWA2002716_HPP
|
---|