2 // Copyright (C) 2009-2012 Lorenzo Caminiti
3 // Distributed under the Boost Software License, Version 1.0
4 // (see accompanying file LICENSE_1_0.txt or a copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6 // Home at http://www.boost.org/libs/local_function
8 #ifndef BOOST_LOCAL_FUNCTION_AUX_MEMBER_HPP_
9 #define BOOST_LOCAL_FUNCTION_AUX_MEMBER_HPP_
11 namespace boost { namespace local_function { namespace aux {
13 // Metafunctions to manipulate data members.
15 template<typename T> struct member_type {
20 template<typename T> struct member_type<T*> {
21 typedef T*& reference;
25 template<typename T> struct member_type<T* const> {
26 typedef T* const& reference;
30 template<typename T> struct member_type<T const*> {
31 typedef T const*& reference;
32 typedef T const* pointer;
35 template<typename T> struct member_type<T const* const> {
36 typedef T const* const& reference;
37 typedef T const* pointer;
40 // NOTE: Do not add specializations for T const[&/*] (ambiguous on VACPP).
41 template<typename T> T* member_addr(T& data) { return &data; }
42 template<typename T> T* member_addr(T* data) { return data; }
44 // NOTE: Do not add specializations for T const[&/*] (ambiguous on VACPP).
45 template<typename T> T& member_deref(T& data) { return data; }
46 template<typename T> T& member_deref(T* data) { return *data; }
50 #endif // #include guard