mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-03-13 18:37:27 +08:00
Initialize non-trivially constructible types when allocating a temp buffer.
This commit is contained in:
parent
64272c7f40
commit
381f8f3139
@ -126,6 +126,12 @@ struct TensorEvaluator<const TensorForcedEvalOp<ArgType_>, Device>
|
||||
EIGEN_STRONG_INLINE bool evalSubExprsIfNeeded(EvaluatorPointerType) {
|
||||
const Index numValues = internal::array_prod(m_impl.dimensions());
|
||||
m_buffer = m_device.get((CoeffReturnType*)m_device.allocate_temp(numValues * sizeof(CoeffReturnType)));
|
||||
|
||||
// Initialize non-trivially constructible types.
|
||||
if (!internal::is_arithmetic<CoeffReturnType>::value) {
|
||||
for (Index i = 0; i < numValues; ++i) new (m_buffer + i) CoeffReturnType();
|
||||
}
|
||||
|
||||
typedef TensorEvalToOp< const typename internal::remove_const<ArgType>::type > EvalTo;
|
||||
EvalTo evalToTmp(m_device.get(m_buffer), m_op);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user