]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/local_function/include/boost/local_function/aux_/member.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / local_function / include / boost / local_function / aux_ / member.hpp
1
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
7
8 #ifndef BOOST_LOCAL_FUNCTION_AUX_MEMBER_HPP_
9 #define BOOST_LOCAL_FUNCTION_AUX_MEMBER_HPP_
10
11 namespace boost { namespace local_function { namespace aux {
12
13 // Metafunctions to manipulate data members.
14
15 template<typename T> struct member_type {
16 typedef T& reference;
17 typedef T* pointer;
18 };
19
20 template<typename T> struct member_type<T*> {
21 typedef T*& reference;
22 typedef T* pointer;
23 };
24
25 template<typename T> struct member_type<T* const> {
26 typedef T* const& reference;
27 typedef T* pointer;
28 };
29
30 template<typename T> struct member_type<T const*> {
31 typedef T const*& reference;
32 typedef T const* pointer;
33 };
34
35 template<typename T> struct member_type<T const* const> {
36 typedef T const* const& reference;
37 typedef T const* pointer;
38 };
39
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; }
43
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; }
47
48 } } } // namespace
49
50 #endif // #include guard
51