Initial commit, includes Lua with broken Luabind as a backup for branching purposes
[terrastrategy.git] / include / luabind / detail / conversion_storage.hpp
blob153112d62370fb068df66bdf07351fb914275c89
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)
5 #ifndef LUABIND_CONVERSION_STORAGE_080930_HPP
6 # define LUABIND_CONVERSION_STORAGE_080930_HPP
8 # include <luabind/config.hpp>
9 # include <boost/aligned_storage.hpp>
11 namespace luabind { namespace detail {
13 typedef void(*destruction_function)(void*);
15 // This is used by the converters in policy.hpp, and
16 // class_rep::convert_to as temporary storage when constructing
17 // holders.
19 struct conversion_storage
21 conversion_storage()
22 : destructor(0)
25 ~conversion_storage()
27 if (destructor)
28 destructor(&data);
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;
38 }} // namespace luabind::detail
40 #endif // LUABIND_CONVERSION_STORAGE_080930_HPP