From 2350caacdc2ca207092ee12f7c605ae9dc192763 Mon Sep 17 00:00:00 2001 From: paolo Date: Wed, 2 Nov 2011 10:06:08 +0000 Subject: 2011-11-02 Paolo Carlini PR libstdc++/50951 * include/bits/random.tcc (operator<<(basic_ostream<>&, const mersenne_twister_engine<>&): Output _M_p too. (operator<<(basic_ostream<>&, const subtract_with_carry_engine<>&): Likewise. (operator>>(basic_istream<>&, mersenne_twister_engine<>&): Reload it. (operator>>(basic_istream<>&, subtract_with_carry_engine<>&): Likewise. * include/bits/random.h (mersenne_twister_engine<>::operator==): Compare _M_p too. (subtract_with_carry_engine<>::operator==): Compare _M_carry and _M_p too. (shuffle_order_engine<>::operator==): Compare _M_v(s) and _M_y too. * testsuite/26_numerics/random/independent_bits_engine/ operators/serialize.cc: Extend. * testsuite/26_numerics/random/subtract_with_carry_engine/ operators/serialize.cc: Likewise. * testsuite/26_numerics/random/discard_block_engine/ operators/serialize.cc: Likewise. * testsuite/26_numerics/random/mersenne_twister_engine/ operators/serialize.cc: Likewise. * testsuite/26_numerics/random/linear_congruential_engine/ operators/serialize.cc: Likewise. * testsuite/26_numerics/random/shuffle_order_engine/ operators/serialize.cc: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@180764 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/include/bits/random.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'libstdc++-v3/include/bits/random.h') diff --git a/libstdc++-v3/include/bits/random.h b/libstdc++-v3/include/bits/random.h index 7c66d633863..d109224d1bf 100644 --- a/libstdc++-v3/include/bits/random.h +++ b/libstdc++-v3/include/bits/random.h @@ -491,7 +491,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION friend bool operator==(const mersenne_twister_engine& __lhs, const mersenne_twister_engine& __rhs) - { return std::equal(__lhs._M_x, __lhs._M_x + state_size, __rhs._M_x); } + { return (std::equal(__lhs._M_x, __lhs._M_x + state_size, __rhs._M_x) + && __lhs._M_p == __rhs._M_p); } /** * @brief Inserts the current state of a % mersenne_twister_engine @@ -705,7 +706,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION friend bool operator==(const subtract_with_carry_engine& __lhs, const subtract_with_carry_engine& __rhs) - { return std::equal(__lhs._M_x, __lhs._M_x + long_lag, __rhs._M_x); } + { return (std::equal(__lhs._M_x, __lhs._M_x + long_lag, __rhs._M_x) + && __lhs._M_carry == __rhs._M_carry + && __lhs._M_p == __rhs._M_p); } /** * @brief Inserts the current state of a % subtract_with_carry_engine @@ -1370,7 +1373,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION friend bool operator==(const shuffle_order_engine& __lhs, const shuffle_order_engine& __rhs) - { return __lhs._M_b == __rhs._M_b; } + { return (__lhs._M_b == __rhs._M_b + && std::equal(__lhs._M_v, __lhs._M_v + __k, __rhs._M_v) + && __lhs._M_y == __rhs._M_y); } /** * @brief Inserts the current state of a %shuffle_order_engine random -- cgit v1.2.1