Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:51:09

0001 /* boost random/detail/ptr_helper.hpp header file
0002  *
0003  * Copyright Jens Maurer 2002
0004  * Distributed under the Boost Software License, Version 1.0. (See
0005  * accompanying file LICENSE_1_0.txt or copy at
0006  * http://www.boost.org/LICENSE_1_0.txt)
0007  *
0008  * See http://www.boost.org for most recent version including documentation.
0009  *
0010  * $Id$
0011  *
0012  */
0013 
0014 #ifndef BOOST_RANDOM_DETAIL_PTR_HELPER_HPP
0015 #define BOOST_RANDOM_DETAIL_PTR_HELPER_HPP
0016 
0017 #include <boost/config.hpp>
0018 
0019 
0020 namespace boost {
0021 namespace random {
0022 namespace detail {
0023 
0024 // type_traits could help here, but I don't want to depend on type_traits.
0025 template<class T>
0026 struct ptr_helper
0027 {
0028   typedef T value_type;
0029   typedef T& reference_type;
0030   typedef const T& rvalue_type;
0031   static reference_type ref(T& r) { return r; }
0032   static const T& ref(const T& r) { return r; }
0033 };
0034 
0035 template<class T>
0036 struct ptr_helper<T&>
0037 {
0038   typedef T value_type;
0039   typedef T& reference_type;
0040   typedef T& rvalue_type;
0041   static reference_type ref(T& r) { return r; }
0042   static const T& ref(const T& r) { return r; }
0043 };
0044 
0045 template<class T>
0046 struct ptr_helper<T*>
0047 {
0048   typedef T value_type;
0049   typedef T& reference_type;
0050   typedef T* rvalue_type;
0051   static reference_type ref(T * p) { return *p; }
0052   static const T& ref(const T * p) { return *p; }
0053 };
0054 
0055 } // namespace detail
0056 } // namespace random
0057 } // namespace boost
0058 
0059 //
0060 // BOOST_RANDOM_PTR_HELPER_SPEC --
0061 //
0062 //  Helper macro for broken compilers defines specializations of
0063 //  ptr_helper.
0064 //
0065 # define BOOST_RANDOM_PTR_HELPER_SPEC(T)
0066 
0067 #endif // BOOST_RANDOM_DETAIL_PTR_HELPER_HPP