Chris@16: /* boost random/detail/ptr_helper.hpp header file Chris@16: * Chris@16: * Copyright Jens Maurer 2002 Chris@16: * Distributed under the Boost Software License, Version 1.0. (See Chris@16: * accompanying file LICENSE_1_0.txt or copy at Chris@16: * http://www.boost.org/LICENSE_1_0.txt) Chris@16: * Chris@16: * See http://www.boost.org for most recent version including documentation. Chris@16: * Chris@101: * $Id$ Chris@16: * Chris@16: */ Chris@16: Chris@16: #ifndef BOOST_RANDOM_DETAIL_PTR_HELPER_HPP Chris@16: #define BOOST_RANDOM_DETAIL_PTR_HELPER_HPP Chris@16: Chris@16: #include Chris@16: Chris@16: Chris@16: namespace boost { Chris@16: namespace random { Chris@16: namespace detail { Chris@16: Chris@16: // type_traits could help here, but I don't want to depend on type_traits. Chris@16: template Chris@16: struct ptr_helper Chris@16: { Chris@16: typedef T value_type; Chris@16: typedef T& reference_type; Chris@16: typedef const T& rvalue_type; Chris@16: static reference_type ref(T& r) { return r; } Chris@16: static const T& ref(const T& r) { return r; } Chris@16: }; Chris@16: Chris@16: template Chris@16: struct ptr_helper Chris@16: { Chris@16: typedef T value_type; Chris@16: typedef T& reference_type; Chris@16: typedef T& rvalue_type; Chris@16: static reference_type ref(T& r) { return r; } Chris@16: static const T& ref(const T& r) { return r; } Chris@16: }; Chris@16: Chris@16: template Chris@16: struct ptr_helper Chris@16: { Chris@16: typedef T value_type; Chris@16: typedef T& reference_type; Chris@16: typedef T* rvalue_type; Chris@16: static reference_type ref(T * p) { return *p; } Chris@16: static const T& ref(const T * p) { return *p; } Chris@16: }; Chris@16: Chris@16: } // namespace detail Chris@16: } // namespace random Chris@16: } // namespace boost Chris@16: Chris@16: // Chris@16: // BOOST_RANDOM_PTR_HELPER_SPEC -- Chris@16: // Chris@16: // Helper macro for broken compilers defines specializations of Chris@16: // ptr_helper. Chris@16: // Chris@16: # define BOOST_RANDOM_PTR_HELPER_SPEC(T) Chris@16: Chris@16: #endif // BOOST_RANDOM_DETAIL_PTR_HELPER_HPP