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/
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,
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; }
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,
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; }
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,
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; }