|
Boost-Commit : |
From: steven_at_[hidden]
Date: 2008-07-08 12:22:47
Author: steven_watanabe
Date: 2008-07-08 12:22:46 EDT (Tue, 08 Jul 2008)
New Revision: 47233
URL: http://svn.boost.org/trac/boost/changeset/47233
Log:
Merge random from trunk
Text files modified:
branches/release/boost/random/detail/signed_unsigned_tools.hpp | 77 ---------------------------------------
branches/release/boost/random/uniform_int.hpp | 5 +-
branches/release/boost/random/uniform_real.hpp | 2
branches/release/boost/random/uniform_smallint.hpp | 4 +-
4 files changed, 7 insertions(+), 81 deletions(-)
Modified: branches/release/boost/random/detail/signed_unsigned_tools.hpp
==============================================================================
--- branches/release/boost/random/detail/signed_unsigned_tools.hpp (original)
+++ branches/release/boost/random/detail/signed_unsigned_tools.hpp 2008-07-08 12:22:46 EDT (Tue, 08 Jul 2008)
@@ -13,87 +13,12 @@
#include <boost/limits.hpp>
#include <boost/config.hpp>
+#include <boost/type_traits/make_unsigned.hpp>
namespace boost {
namespace random {
namespace detail {
-/*
- * Given an (integral) type T, returns the type "unsigned T".
- * (type_traits appears to be lacking the feature)
- */
-
-template<class T>
-struct make_unsigned { };
-
-template<>
-struct make_unsigned<char>
-{
- typedef unsigned char type;
-};
-
-template<>
-struct make_unsigned<signed char>
-{
- typedef unsigned char type;
-};
-
-template<>
-struct make_unsigned<unsigned char>
-{
- typedef unsigned char type;
-};
-
-template<>
-struct make_unsigned<short>
-{
- typedef unsigned short type;
-};
-
-template<>
-struct make_unsigned<unsigned short>
-{
- typedef unsigned short type;
-};
-
-template<>
-struct make_unsigned<int>
-{
- typedef unsigned int type;
-};
-
-template<>
-struct make_unsigned<unsigned int>
-{
- typedef unsigned int type;
-};
-
-template<>
-struct make_unsigned<long>
-{
- typedef unsigned long type;
-};
-
-template<>
-struct make_unsigned<unsigned long>
-{
- typedef unsigned long type;
-};
-
-#ifdef BOOST_HAS_LONG_LONG
-template<>
-struct make_unsigned<long long>
-{
- typedef unsigned long long type;
-};
-
-template<>
-struct make_unsigned<unsigned long long>
-{
- typedef unsigned long long type;
-};
-#endif
-
/*
* Compute x - y, we know that x >= y, return an unsigned value.
Modified: branches/release/boost/random/uniform_int.hpp
==============================================================================
--- branches/release/boost/random/uniform_int.hpp (original)
+++ branches/release/boost/random/uniform_int.hpp 2008-07-08 12:22:46 EDT (Tue, 08 Jul 2008)
@@ -25,6 +25,7 @@
#include <boost/detail/workaround.hpp>
#include <boost/random/uniform_smallint.hpp>
#include <boost/random/detail/signed_unsigned_tools.hpp>
+#include <boost/type_traits/make_unsigned.hpp>
#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
#include <boost/type_traits/is_float.hpp>
#endif
@@ -38,7 +39,7 @@
public:
typedef IntType input_type;
typedef IntType result_type;
- typedef typename random::detail::make_unsigned<result_type>::type range_type;
+ typedef typename make_unsigned<result_type>::type range_type;
explicit uniform_int(IntType min_arg = 0, IntType max_arg = 9)
: _min(min_arg), _max(max_arg)
@@ -61,7 +62,7 @@
{
typedef typename Engine::result_type base_result;
// ranges are always unsigned
- typedef typename random::detail::make_unsigned<base_result>::type base_unsigned;
+ typedef typename make_unsigned<base_result>::type base_unsigned;
const base_result bmin = (eng.min)();
const base_unsigned brange =
random::detail::subtract<base_result>()((eng.max)(), (eng.min)());
Modified: branches/release/boost/random/uniform_real.hpp
==============================================================================
--- branches/release/boost/random/uniform_real.hpp (original)
+++ branches/release/boost/random/uniform_real.hpp 2008-07-08 12:22:46 EDT (Tue, 08 Jul 2008)
@@ -40,7 +40,7 @@
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
BOOST_STATIC_ASSERT(!std::numeric_limits<RealType>::is_integer);
#endif
- assert(min_arg < max_arg);
+ assert(min_arg <= max_arg);
}
// compiler-generated copy ctor and assignment operator are fine
Modified: branches/release/boost/random/uniform_smallint.hpp
==============================================================================
--- branches/release/boost/random/uniform_smallint.hpp (original)
+++ branches/release/boost/random/uniform_smallint.hpp 2008-07-08 12:22:46 EDT (Tue, 08 Jul 2008)
@@ -81,7 +81,7 @@
{
_min = min_arg;
_max = max_arg;
- assert(min_arg < max_arg);
+ assert(min_arg <= max_arg);
_range = static_cast<base_result>(_max-_min)+1;
_factor = 1;
@@ -122,7 +122,7 @@
BOOST_STATIC_ASSERT(!std::numeric_limits<typename base_type::result_type>::is_integer);
#endif
- assert(min_arg < max_arg);
+ assert(min_arg <= max_arg);
set(min_arg, max_arg);
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk