Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:44:55

0001 
0002 // Copyright (C) 2009-2012 Lorenzo Caminiti
0003 // Distributed under the Boost Software License, Version 1.0
0004 // (see accompanying file LICENSE_1_0.txt or a copy at
0005 // http://www.boost.org/LICENSE_1_0.txt)
0006 // Home at http://www.boost.org/libs/local_function
0007 
0008 #ifndef BOOST_LOCAL_FUNCTION_AUX_MEMBER_HPP_
0009 #define BOOST_LOCAL_FUNCTION_AUX_MEMBER_HPP_
0010 
0011 namespace boost { namespace local_function { namespace aux {
0012 
0013 // Metafunctions to manipulate data members.
0014 
0015 template<typename T> struct member_type {
0016     typedef T& reference;
0017     typedef T* pointer;
0018 };
0019 
0020 template<typename T> struct member_type<T*> {
0021     typedef T*& reference;
0022     typedef T* pointer;
0023 };
0024 
0025 template<typename T> struct member_type<T* const> {
0026     typedef T* const& reference;
0027     typedef T* pointer;
0028 };
0029 
0030 template<typename T> struct member_type<T const*> {
0031     typedef T const*& reference;
0032     typedef T const* pointer;
0033 };
0034 
0035 template<typename T> struct member_type<T const* const> {
0036     typedef T const* const& reference;
0037     typedef T const* pointer;
0038 };
0039 
0040 // NOTE: Do not add specializations for T const[&/*] (ambiguous on VACPP).
0041 template<typename T> T* member_addr(T& data) { return &data; }
0042 template<typename T> T* member_addr(T* data) { return data; }
0043 
0044 // NOTE: Do not add specializations for T const[&/*] (ambiguous on VACPP).
0045 template<typename T> T& member_deref(T& data) { return data; }
0046 template<typename T> T& member_deref(T* data) { return *data; }
0047 
0048 } } } // namespace
0049 
0050 #endif // #include guard
0051