OSDN Git Service

build moflib1.0 on cmake-base system
[moflib/moflib.git] / moflib-1.0 / extlib / luabind-0.8 / luabind / detail / conversion_storage.hpp
1 // Copyright Daniel Wallin 2008. Use, modification and distribution is
2 // subject to the Boost Software License, Version 1.0. (See accompanying
3 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4
5 #ifndef LUABIND_CONVERSION_STORAGE_080930_HPP
6 # define LUABIND_CONVERSION_STORAGE_080930_HPP
7
8 # include <luabind/config.hpp>
9 # include <boost/aligned_storage.hpp>
10
11 namespace luabind { namespace detail {
12
13 typedef void(*destruction_function)(void*);
14
15 // This is used by the converters in policy.hpp, and
16 // class_rep::convert_to as temporary storage when constructing
17 // holders.
18
19 struct conversion_storage
20 {
21     conversion_storage()
22       : destructor(0)
23     {}
24
25     ~conversion_storage()
26     {
27         if (destructor)
28             destructor(&data);
29     }
30
31     // Unfortunately the converters currently doesn't have access to
32     // the actual type being converted when this is instantiated, so
33     // we have to guess a max size.
34     boost::aligned_storage<128> data;
35     destruction_function destructor;
36 };
37
38 }} // namespace luabind::detail
39
40 #endif // LUABIND_CONVERSION_STORAGE_080930_HPP
41