7 #ifndef _QITYPE_DETAILS_ACCESSOR_HXX_
8 #define _QITYPE_DETAILS_ACCESSOR_HXX_
10 #include <boost/type_traits.hpp>
11 #include <boost/utility/enable_if.hpp>
20 template<
typename T,
typename Vo
id =
void>
struct Accessor
22 typedef boost::false_type is_accessor;
27 typedef typename boost::remove_const<T>::type
value_type;
32 template<
typename C,
typename T>
struct Accessor<T C::*, typename boost::enable_if<typename boost::is_member_object_pointer<T C::*> >::type >
36 static T& access(C* instance, type acc)
38 return *instance.*acc;
41 template<
typename C,
typename T>
struct Accessor<T& (C::*)()>
42 :
public AccessorBase<C, T>
44 typedef T& (C::*type)();
45 static T& access(C* instance, type acc)
47 return (*instance.*acc)();
50 template<
typename C,
typename T>
struct Accessor<T& (C::*)()
const>
51 :
public AccessorBase<C, T>
53 typedef T& (C::*type)()
const;
54 static T& access(C* instance, type acc)
56 return (*instance.*acc)();
59 template<
typename C,
typename T>
struct Accessor<T& (*)(C*)>
60 :
public AccessorBase<C, T>
62 typedef T& (*type)(C*);
63 static T& access(C* instance, type acc)
71 #endif // _QITYPE_DETAILS_ACCESSOR_HXX_
boost::true_type is_accessor
boost::remove_const< T >::type value_type