diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-10-12 18:38:42 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-10-12 18:38:42 +0000 |
commit | a10fc41a0de5e88df4bfeeda0b72f41101232913 (patch) | |
tree | 22b090235ce54e9a74938d246cc20dcd24eed722 /libstdc++-v3 | |
parent | 56d532b6c3d29a2944715bcc30045b853da44d26 (diff) | |
download | gcc-a10fc41a0de5e88df4bfeeda0b72f41101232913.tar.gz |
2010-10-12 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/random.h (discrete_distribution<>::param_type):
Disable move operations.
(piecewise_constant_distribution<>::param_type): Likewise.
(piecewise_linear_distribution<>::param_type): Likewise.
* include/bits/random.h (discrete_distribution<>::param_type::
param_type()): Simplify, don't use _M_initialize.
(piecewise_constant_distribution<>::param_type::param_type()):
Likewise.
(piecewise_linear_distribution<>::param_type::param_type()):
Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165391 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/ChangeLog | 14 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/random.h | 24 |
2 files changed, 32 insertions, 6 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index b6bd2ef998d..29413e77125 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,19 @@ 2010-10-12 Paolo Carlini <paolo.carlini@oracle.com> + * include/bits/random.h (discrete_distribution<>::param_type): + Disable move operations. + (piecewise_constant_distribution<>::param_type): Likewise. + (piecewise_linear_distribution<>::param_type): Likewise. + + * include/bits/random.h (discrete_distribution<>::param_type:: + param_type()): Simplify, don't use _M_initialize. + (piecewise_constant_distribution<>::param_type::param_type()): + Likewise. + (piecewise_linear_distribution<>::param_type::param_type()): + Likewise. + +2010-10-12 Paolo Carlini <paolo.carlini@oracle.com> + * include/bits/random.tcc (piecewise_linear_distribution<>:: operator()): Don't crash when the dist is default-constructed. * testsuite/26_numerics/random/piecewise_linear_distribution/ diff --git a/libstdc++-v3/include/bits/random.h b/libstdc++-v3/include/bits/random.h index 4c3ebe2fc65..2477d57a9e1 100644 --- a/libstdc++-v3/include/bits/random.h +++ b/libstdc++-v3/include/bits/random.h @@ -4697,8 +4697,8 @@ namespace std friend class discrete_distribution<_IntType>; param_type() - : _M_prob(), _M_cp() - { _M_initialize(); } + : _M_prob(1, 1.0), _M_cp() + { } template<typename _InputIterator> param_type(_InputIterator __wbegin, @@ -4714,6 +4714,10 @@ namespace std param_type(size_t __nw, double __xmin, double __xmax, _Func __fw); + // See: http://cpp-next.com/archive/2010/10/implicit-move-must-go/ + param_type(const param_type&) = default; + param_type& operator=(const param_type&) = default; + std::vector<double> probabilities() const { return _M_prob; } @@ -4889,8 +4893,8 @@ namespace std friend class piecewise_constant_distribution<_RealType>; param_type() - : _M_int(), _M_den(), _M_cp() - { _M_initialize(); } + : _M_int(2), _M_den(1, 1.0), _M_cp() + { _M_int[1] = _RealType(1); } template<typename _InputIteratorB, typename _InputIteratorW> param_type(_InputIteratorB __bfirst, @@ -4904,6 +4908,10 @@ namespace std param_type(size_t __nw, _RealType __xmin, _RealType __xmax, _Func __fw); + // See: http://cpp-next.com/archive/2010/10/implicit-move-must-go/ + param_type(const param_type&) = default; + param_type& operator=(const param_type&) = default; + std::vector<_RealType> intervals() const { return _M_int; } @@ -5097,8 +5105,8 @@ namespace std friend class piecewise_linear_distribution<_RealType>; param_type() - : _M_int(), _M_den(), _M_cp(), _M_m() - { _M_initialize(); } + : _M_int(2), _M_den(2, 1.0), _M_cp(), _M_m() + { _M_int[1] = _RealType(1); } template<typename _InputIteratorB, typename _InputIteratorW> param_type(_InputIteratorB __bfirst, @@ -5112,6 +5120,10 @@ namespace std param_type(size_t __nw, _RealType __xmin, _RealType __xmax, _Func __fw); + // See: http://cpp-next.com/archive/2010/10/implicit-move-must-go/ + param_type(const param_type&) = default; + param_type& operator=(const param_type&) = default; + std::vector<_RealType> intervals() const { return _M_int; } |