Patch by Marshall Clow to make the assignment operators of piecewise_constant_distribution and piecewise_linear_distribution exception safe.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116404 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
08f2969220
commit
3c143ad882
@ -5938,6 +5938,7 @@ public:
|
|||||||
template<class _UnaryOperation>
|
template<class _UnaryOperation>
|
||||||
param_type(size_t __nw, result_type __xmin, result_type __xmax,
|
param_type(size_t __nw, result_type __xmin, result_type __xmax,
|
||||||
_UnaryOperation __fw);
|
_UnaryOperation __fw);
|
||||||
|
param_type & operator=(const param_type& __rhs);
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
vector<result_type> intervals() const {return __b_;}
|
vector<result_type> intervals() const {return __b_;}
|
||||||
@ -6047,6 +6048,23 @@ public:
|
|||||||
piecewise_constant_distribution<_RT>& __x);
|
piecewise_constant_distribution<_RT>& __x);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<class _RealType>
|
||||||
|
typename piecewise_constant_distribution<_RealType>::param_type &
|
||||||
|
piecewise_constant_distribution<_RealType>::param_type::operator=
|
||||||
|
(const param_type& __rhs)
|
||||||
|
{
|
||||||
|
// These can throw
|
||||||
|
__b_.reserve (__rhs.__b_.size ());
|
||||||
|
__densities_.reserve(__rhs.__densities_.size());
|
||||||
|
__areas_.reserve (__rhs.__areas_.size());
|
||||||
|
|
||||||
|
// These can not throw
|
||||||
|
__b_ = __rhs.__b_;
|
||||||
|
__densities_ = __rhs.__densities_;
|
||||||
|
__areas_ = __rhs.__areas_;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
template<class _RealType>
|
template<class _RealType>
|
||||||
void
|
void
|
||||||
piecewise_constant_distribution<_RealType>::param_type::__init()
|
piecewise_constant_distribution<_RealType>::param_type::__init()
|
||||||
@ -6239,6 +6257,7 @@ public:
|
|||||||
template<class _UnaryOperation>
|
template<class _UnaryOperation>
|
||||||
param_type(size_t __nw, result_type __xmin, result_type __xmax,
|
param_type(size_t __nw, result_type __xmin, result_type __xmax,
|
||||||
_UnaryOperation __fw);
|
_UnaryOperation __fw);
|
||||||
|
param_type & operator=(const param_type& __rhs);
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
vector<result_type> intervals() const {return __b_;}
|
vector<result_type> intervals() const {return __b_;}
|
||||||
@ -6348,6 +6367,24 @@ public:
|
|||||||
piecewise_linear_distribution<_RT>& __x);
|
piecewise_linear_distribution<_RT>& __x);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<class _RealType>
|
||||||
|
typename piecewise_linear_distribution<_RealType>::param_type &
|
||||||
|
piecewise_linear_distribution<_RealType>::param_type::operator=
|
||||||
|
(const param_type& __rhs)
|
||||||
|
{
|
||||||
|
// These can throw
|
||||||
|
__b_.reserve (__rhs.__b_.size ());
|
||||||
|
__densities_.reserve(__rhs.__densities_.size());
|
||||||
|
__areas_.reserve (__rhs.__areas_.size());
|
||||||
|
|
||||||
|
// These can not throw
|
||||||
|
__b_ = __rhs.__b_;
|
||||||
|
__densities_ = __rhs.__densities_;
|
||||||
|
__areas_ = __rhs.__areas_;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class _RealType>
|
template<class _RealType>
|
||||||
void
|
void
|
||||||
piecewise_linear_distribution<_RealType>::param_type::__init()
|
piecewise_linear_distribution<_RealType>::param_type::__init()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user