OSDN Git Service

2c30ce000a32600e9e433d8c5dc49caccadec444
[moflib/moflib.git] / extlib / luabind-0.8 / luabind / detail / property.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_PROPERTY_081020_HPP
6 # define LUABIND_PROPERTY_081020_HPP
7
8 namespace luabind { namespace detail {
9
10 template <class Class, class T, class Result = T>
11 struct access_member_ptr
12 {
13     access_member_ptr(T Class::* mem_ptr)
14       : mem_ptr(mem_ptr)
15     {}
16
17     Result operator()(Class const& x) const
18     {
19         return const_cast<Class&>(x).*mem_ptr;
20     }
21
22     void operator()(Class& x, T const& value) const
23     {
24         x.*mem_ptr = value;
25     }
26
27     T Class::* mem_ptr;
28 };
29
30 }} // namespace luabind::detail
31
32 #endif // LUABIND_PROPERTY_081020_HPP
33