2010-10-12 Paolo Carlini <paolo.carlini@oracle.com>
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 12 Oct 2010 18:38:42 +0000 (18:38 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 12 Oct 2010 18:38:42 +0000 (18:38 +0000)
* 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

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/random.h

index b6bd2ef..29413e7 100644 (file)
@@ -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/
index 4c3ebe2..2477d57 100644 (file)
@@ -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; }