eclmpiserializer: improve ptr handler

use has_serializeOp trait
This commit is contained in:
Arne Morten Kvarving 2022-09-02 13:02:35 +02:00
parent e7624b7a27
commit 9be60f2b3f

View File

@ -497,8 +497,6 @@ protected:
}
//! \brief Handler for smart pointers.
//! \details If data is POD or a string, we pass it to the underlying serializer,
//! if not we assume a complex type.
template<class PtrType>
void ptr(const PtrType& data)
{
@ -508,8 +506,12 @@ protected:
if (m_op == Operation::UNPACK && value) {
const_cast<PtrType&>(data).reset(new T1);
}
if (data)
data->serializeOp(*this);
if (data) {
if constexpr (has_serializeOp<T1>::value)
data->serializeOp(*this);
else
(*this)(*data);
}
}
Parallel::Communication m_comm; //!< Communicator to broadcast using