Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
1 /* boost random/detail/uniform_int_float.hpp header file
3 * Copyright Jens Maurer 2000-2001
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: pass_through_engine.hpp,v 1.5 2004/07/27 03:43:32 dgregor Exp $
14 #ifndef BOOST_RANDOM_DETAIL_PASS_THROUGH_ENGINE_HPP
15 #define BOOST_RANDOM_DETAIL_PASS_THROUGH_ENGINE_HPP
17 #include <boost/config.hpp>
18 #include <boost/random/detail/ptr_helper.hpp>
25 template<class UniformRandomNumberGenerator>
26 class pass_through_engine
29 typedef ptr_helper<UniformRandomNumberGenerator> helper_type;
32 typedef typename helper_type::value_type base_type;
33 typedef typename base_type::result_type result_type;
35 explicit pass_through_engine(UniformRandomNumberGenerator rng)
36 // make argument an rvalue to avoid matching Generator& constructor
37 : _rng(static_cast<typename helper_type::rvalue_type>(rng))
40 result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return (base().min)(); }
41 result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return (base().max)(); }
42 base_type& base() { return helper_type::ref(_rng); }
43 const base_type& base() const { return helper_type::ref(_rng); }
45 result_type operator()() { return base()(); }
48 UniformRandomNumberGenerator _rng;
51 #ifndef BOOST_NO_STD_LOCALE
53 template<class UniformRandomNumberGenerator, class CharT, class Traits>
54 std::basic_ostream<CharT,Traits>&
56 std::basic_ostream<CharT,Traits>& os
57 , const pass_through_engine<UniformRandomNumberGenerator>& ud
60 return os << ud.base();
63 template<class UniformRandomNumberGenerator, class CharT, class Traits>
64 std::basic_istream<CharT,Traits>&
66 std::basic_istream<CharT,Traits>& is
67 , const pass_through_engine<UniformRandomNumberGenerator>& ud
70 return is >> ud.base();
73 #else // no new streams
75 template<class UniformRandomNumberGenerator>
77 operator<<(std::ostream& os,
78 const pass_through_engine<UniformRandomNumberGenerator>& ud)
80 return os << ud.base();
83 template<class UniformRandomNumberGenerator>
85 operator>>(std::istream& is,
86 const pass_through_engine<UniformRandomNumberGenerator>& ud)
88 return is >> ud.base();
97 #endif // BOOST_RANDOM_DETAIL_PASS_THROUGH_ENGINE_HPP