Commit ce9555cb by Paolo Carlini Committed by Paolo Carlini

random.h (discrete_distribution<>::param_type): Disable move operations.

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.

From-SVN: r165391
parent 0c86e0dd
2010-10-12 Paolo Carlini <paolo.carlini@oracle.com> 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<>:: * include/bits/random.tcc (piecewise_linear_distribution<>::
operator()): Don't crash when the dist is default-constructed. operator()): Don't crash when the dist is default-constructed.
* testsuite/26_numerics/random/piecewise_linear_distribution/ * testsuite/26_numerics/random/piecewise_linear_distribution/
......
...@@ -4697,8 +4697,8 @@ namespace std ...@@ -4697,8 +4697,8 @@ namespace std
friend class discrete_distribution<_IntType>; friend class discrete_distribution<_IntType>;
param_type() param_type()
: _M_prob(), _M_cp() : _M_prob(1, 1.0), _M_cp()
{ _M_initialize(); } { }
template<typename _InputIterator> template<typename _InputIterator>
param_type(_InputIterator __wbegin, param_type(_InputIterator __wbegin,
...@@ -4714,6 +4714,10 @@ namespace std ...@@ -4714,6 +4714,10 @@ namespace std
param_type(size_t __nw, double __xmin, double __xmax, param_type(size_t __nw, double __xmin, double __xmax,
_Func __fw); _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> std::vector<double>
probabilities() const probabilities() const
{ return _M_prob; } { return _M_prob; }
...@@ -4889,8 +4893,8 @@ namespace std ...@@ -4889,8 +4893,8 @@ namespace std
friend class piecewise_constant_distribution<_RealType>; friend class piecewise_constant_distribution<_RealType>;
param_type() param_type()
: _M_int(), _M_den(), _M_cp() : _M_int(2), _M_den(1, 1.0), _M_cp()
{ _M_initialize(); } { _M_int[1] = _RealType(1); }
template<typename _InputIteratorB, typename _InputIteratorW> template<typename _InputIteratorB, typename _InputIteratorW>
param_type(_InputIteratorB __bfirst, param_type(_InputIteratorB __bfirst,
...@@ -4904,6 +4908,10 @@ namespace std ...@@ -4904,6 +4908,10 @@ namespace std
param_type(size_t __nw, _RealType __xmin, _RealType __xmax, param_type(size_t __nw, _RealType __xmin, _RealType __xmax,
_Func __fw); _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> std::vector<_RealType>
intervals() const intervals() const
{ return _M_int; } { return _M_int; }
...@@ -5097,8 +5105,8 @@ namespace std ...@@ -5097,8 +5105,8 @@ namespace std
friend class piecewise_linear_distribution<_RealType>; friend class piecewise_linear_distribution<_RealType>;
param_type() param_type()
: _M_int(), _M_den(), _M_cp(), _M_m() : _M_int(2), _M_den(2, 1.0), _M_cp(), _M_m()
{ _M_initialize(); } { _M_int[1] = _RealType(1); }
template<typename _InputIteratorB, typename _InputIteratorW> template<typename _InputIteratorB, typename _InputIteratorW>
param_type(_InputIteratorB __bfirst, param_type(_InputIteratorB __bfirst,
...@@ -5112,6 +5120,10 @@ namespace std ...@@ -5112,6 +5120,10 @@ namespace std
param_type(size_t __nw, _RealType __xmin, _RealType __xmax, param_type(size_t __nw, _RealType __xmin, _RealType __xmax,
_Func __fw); _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> std::vector<_RealType>
intervals() const intervals() const
{ return _M_int; } { return _M_int; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment