Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r68789 - in trunk/boost/random: . detail
From: steven_at_[hidden]
Date: 2011-02-11 17:07:05


Author: steven_watanabe
Date: 2011-02-11 17:07:04 EST (Fri, 11 Feb 2011)
New Revision: 68789
URL: http://svn.boost.org/trac/boost/changeset/68789

Log:
Codegear fixes.
Text files modified:
   trunk/boost/random/additive_combine.hpp | 10 ++++++++--
   trunk/boost/random/detail/operators.hpp | 15 ++++++++++++++-
   trunk/boost/random/uniform_int.hpp | 18 +++++++++++++++---
   3 files changed, 37 insertions(+), 6 deletions(-)

Modified: trunk/boost/random/additive_combine.hpp
==============================================================================
--- trunk/boost/random/additive_combine.hpp (original)
+++ trunk/boost/random/additive_combine.hpp 2011-02-11 17:07:04 EST (Fri, 11 Feb 2011)
@@ -78,7 +78,10 @@
      */
     BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR(additive_combine_engine,
         result_type, seed_arg)
- : _mlcg1(seed_arg), _mlcg2(seed_arg) { }
+ {
+ _mlcg1.seed(seed_arg);
+ _mlcg2.seed(seed_arg);
+ }
     /**
      * Constructs an @c additive_combine_engine, using seq as
      * the constructor argument for both base generators.
@@ -93,7 +96,10 @@
      */
     BOOST_RANDOM_DETAIL_SEED_SEQ_CONSTRUCTOR(additive_combine_engine,
         SeedSeq, seq)
- : _mlcg1(seq), _mlcg2(seq) { }
+ {
+ _mlcg1.seed(seq);
+ _mlcg2.seed(seq);
+ }
     /**
      * Constructs an @c additive_combine_engine, using
      * @c seed1 and @c seed2 as the constructor argument to

Modified: trunk/boost/random/detail/operators.hpp
==============================================================================
--- trunk/boost/random/detail/operators.hpp (original)
+++ trunk/boost/random/detail/operators.hpp 2011-02-11 17:07:04 EST (Fri, 11 Feb 2011)
@@ -1,6 +1,6 @@
 /* boost random/detail/operators.hpp header file
  *
- * Copyright Steven Watanabe 2010
+ * Copyright Steven Watanabe 2010-2011
  * Distributed under the Boost Software License, Version 1.0. (See
  * accompanying file LICENSE_1_0.txt or copy at
  * http://www.boost.org/LICENSE_1_0.txt)
@@ -43,6 +43,19 @@
 
 #endif
 
+#if defined(__BORLANDC__)
+
+#define BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR(T, lhs, rhs) \
+ bool operator==(const T& rhs) const \
+ { return T::is_equal(*this, rhs); } \
+ static bool is_equal(const T& lhs, const T& rhs)
+
+#define BOOST_RANDOM_DETAIL_INEQUALITY_OPERATOR(T) \
+ bool operator!=(const T& rhs) const \
+ { return !T::is_equal(*this, rhs); }
+
+#endif
+
 #ifndef BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR
 #define BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR(os, T, t) \
     template<class CharT, class Traits> \

Modified: trunk/boost/random/uniform_int.hpp
==============================================================================
--- trunk/boost/random/uniform_int.hpp (original)
+++ trunk/boost/random/uniform_int.hpp 2011-02-11 17:07:04 EST (Fri, 11 Feb 2011)
@@ -72,13 +72,25 @@
     /** Sets the parameters of the distribution. */
     void param(const param_type& parm) { this->base_type::param(parm); }
 
- using base_type::operator();
+ // Codergear seems to have trouble with a using declaration here
 
     template<class Engine>
- IntType operator()(Engine& eng, IntType n)
+ IntType operator()(Engine& eng) const
+ {
+ return static_cast<const base_type&>(*this)(eng);
+ }
+
+ template<class Engine>
+ IntType operator()(Engine& eng, const param_type& parm) const
+ {
+ return static_cast<const base_type&>(*this)(eng, parm);
+ }
+
+ template<class Engine>
+ IntType operator()(Engine& eng, IntType n) const
     {
         assert(n > 0);
- return (*this)(eng, param_type(0, n - 1));
+ return static_cast<const base_type&>(*this)(eng, param_type(0, n - 1));
     }
 };
 


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