Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
1 /* boost random/detail/ptr_helper.hpp header file
3 * Copyright Jens Maurer 2002
4 * Distributed under the Boost Software License, Version 1.0. (See
5 * accompanying file LICENSE_1_0.txt or copy at
6 * http://www.boost.org/LICENSE_1_0.txt)
8 * See http://www.boost.org for most recent version including documentation.
10 * $Id: ptr_helper.hpp,v 1.3 2004/07/27 03:43:32 dgregor Exp $
14 #ifndef BOOST_RANDOM_DETAIL_PTR_HELPER_HPP
15 #define BOOST_RANDOM_DETAIL_PTR_HELPER_HPP
17 #include <boost/config.hpp>
24 // type_traits could help here, but I don't want to depend on type_traits.
29 typedef T& reference_type;
30 typedef const T& rvalue_type;
31 static reference_type ref(T& r) { return r; }
32 static const T& ref(const T& r) { return r; }
35 #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
40 typedef T& reference_type;
41 typedef T& rvalue_type;
42 static reference_type ref(T& r) { return r; }
43 static const T& ref(const T& r) { return r; }
50 typedef T& reference_type;
51 typedef T* rvalue_type;
52 static reference_type ref(T * p) { return *p; }
53 static const T& ref(const T * p) { return *p; }
62 // BOOST_RANDOM_PTR_HELPER_SPEC --
64 // Helper macro for broken compilers defines specializations of
67 #ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
68 # define BOOST_RANDOM_PTR_HELPER_SPEC(T) \
69 namespace boost { namespace random { namespace detail { \
71 struct ptr_helper<T&> \
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; } \
81 struct ptr_helper<T*> \
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; } \
91 # define BOOST_RANDOM_PTR_HELPER_SPEC(T)
94 #endif // BOOST_RANDOM_DETAIL_PTR_HELPER_HPP