comparison DEPENDENCIES/generic/include/boost/random/detail/ptr_helper.hpp @ 101:c530137014c0

Update Boost headers (1.58.0)
author Chris Cannam
date Mon, 07 Sep 2015 11:12:49 +0100
parents 2665513ce2d3
children
comparison
equal deleted inserted replaced
100:793467b5e61c 101:c530137014c0
5 * accompanying file LICENSE_1_0.txt or copy at 5 * accompanying file LICENSE_1_0.txt or copy at
6 * http://www.boost.org/LICENSE_1_0.txt) 6 * http://www.boost.org/LICENSE_1_0.txt)
7 * 7 *
8 * See http://www.boost.org for most recent version including documentation. 8 * See http://www.boost.org for most recent version including documentation.
9 * 9 *
10 * $Id: ptr_helper.hpp 24096 2004-07-27 03:43:34Z dgregor $ 10 * $Id$
11 * 11 *
12 */ 12 */
13 13
14 #ifndef BOOST_RANDOM_DETAIL_PTR_HELPER_HPP 14 #ifndef BOOST_RANDOM_DETAIL_PTR_HELPER_HPP
15 #define BOOST_RANDOM_DETAIL_PTR_HELPER_HPP 15 #define BOOST_RANDOM_DETAIL_PTR_HELPER_HPP
30 typedef const T& rvalue_type; 30 typedef const T& rvalue_type;
31 static reference_type ref(T& r) { return r; } 31 static reference_type ref(T& r) { return r; }
32 static const T& ref(const T& r) { return r; } 32 static const T& ref(const T& r) { return r; }
33 }; 33 };
34 34
35 #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
36 template<class T> 35 template<class T>
37 struct ptr_helper<T&> 36 struct ptr_helper<T&>
38 { 37 {
39 typedef T value_type; 38 typedef T value_type;
40 typedef T& reference_type; 39 typedef T& reference_type;
50 typedef T& reference_type; 49 typedef T& reference_type;
51 typedef T* rvalue_type; 50 typedef T* rvalue_type;
52 static reference_type ref(T * p) { return *p; } 51 static reference_type ref(T * p) { return *p; }
53 static const T& ref(const T * p) { return *p; } 52 static const T& ref(const T * p) { return *p; }
54 }; 53 };
55 #endif
56 54
57 } // namespace detail 55 } // namespace detail
58 } // namespace random 56 } // namespace random
59 } // namespace boost 57 } // namespace boost
60 58
62 // BOOST_RANDOM_PTR_HELPER_SPEC -- 60 // BOOST_RANDOM_PTR_HELPER_SPEC --
63 // 61 //
64 // Helper macro for broken compilers defines specializations of 62 // Helper macro for broken compilers defines specializations of
65 // ptr_helper. 63 // ptr_helper.
66 // 64 //
67 #ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
68 # define BOOST_RANDOM_PTR_HELPER_SPEC(T) \
69 namespace boost { namespace random { namespace detail { \
70 template<> \
71 struct ptr_helper<T&> \
72 { \
73 typedef T value_type; \
74 typedef T& reference_type; \
75 typedef T& rvalue_type; \
76 static reference_type ref(T& r) { return r; } \
77 static const T& ref(const T& r) { return r; } \
78 }; \
79 \
80 template<> \
81 struct ptr_helper<T*> \
82 { \
83 typedef T value_type; \
84 typedef T& reference_type; \
85 typedef T* rvalue_type; \
86 static reference_type ref(T * p) { return *p; } \
87 static const T& ref(const T * p) { return *p; } \
88 }; \
89 }}}
90 #else
91 # define BOOST_RANDOM_PTR_HELPER_SPEC(T) 65 # define BOOST_RANDOM_PTR_HELPER_SPEC(T)
92 #endif
93 66
94 #endif // BOOST_RANDOM_DETAIL_PTR_HELPER_HPP 67 #endif // BOOST_RANDOM_DETAIL_PTR_HELPER_HPP