Initial C++0x support.
[luabind.git] / luabind / copy_policy.hpp
blob1a18b729b3027427e382d3eb6049376c3d4edebf
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_COPY_POLICY_081021_HPP
6 # define LUABIND_COPY_POLICY_081021_HPP
8 # include <luabind/detail/policy.hpp>
10 namespace luabind {
12 namespace detail
15 struct copy_converter
17 template <class T>
18 void apply(lua_State* L, T const& x)
20 value_converter().apply(L, x);
23 template <class T>
24 void apply(lua_State* L, T* x)
26 if (!x)
27 lua_pushnil(L);
28 else
29 apply(L, *x);
33 template <int N>
34 struct copy_policy : conversion_policy<N>
36 static void precall(lua_State*, index_map const&)
39 static void postcall(lua_State*, index_map const&)
42 template <class T, class Direction>
43 struct apply
45 typedef copy_converter type;
49 } // namespace detail
51 template <int N>
52 detail::policy_cons<detail::copy_policy<N>, detail::null_type>
53 copy(LUABIND_PLACEHOLDER_ARG(N))
55 return detail::policy_cons<detail::copy_policy<N>, detail::null_type>();
58 } // namespace luabind
60 #endif // LUABIND_COPY_POLICY_081021_HPP