diff --git a/ebos/eclmpiserializer.hh b/ebos/eclmpiserializer.hh index 224837499..2ad045af3 100644 --- a/ebos/eclmpiserializer.hh +++ b/ebos/eclmpiserializer.hh @@ -40,8 +40,8 @@ public: template void operator()(const T& data) { - if constexpr (is_shared_ptr::value) { - shared_ptr(data); + if constexpr (is_ptr::value) { + ptr(data); } else { if (m_op == Operation::PACKSIZE) m_packSize += Mpi::packSize(data, m_comm); @@ -60,8 +60,8 @@ public: for (auto& it : d) { if constexpr (is_pair::value) pair(it); - else if constexpr (is_shared_ptr::value) - shared_ptr(it); + else if constexpr (is_ptr::value) + ptr(it); else it.serializeOp(*this); } @@ -91,8 +91,8 @@ public: { if constexpr (is_vector::value) vector(d); - else if constexpr (is_shared_ptr::value) - shared_ptr(d); + else if constexpr (is_ptr::value) + ptr(d); else if constexpr (!complexType) d.template serializeOp(*this); else @@ -196,12 +196,17 @@ protected: }; template - struct is_shared_ptr { + struct is_ptr { constexpr static bool value = false; }; template - struct is_shared_ptr> { + struct is_ptr> { + constexpr static bool value = true; + }; + + template + struct is_ptr> { constexpr static bool value = true; }; @@ -219,13 +224,13 @@ protected: const_cast(data.second).serializeOp(*this); } - template - void shared_ptr(const std::shared_ptr& data) + template class PtrType, class T1> + void ptr(const PtrType& data) { bool value = data ? true : false; (*this)(value); if (m_op == Operation::UNPACK && value) { - const_cast&>(data) = std::make_shared(); + const_cast&>(data).reset(new T1); } if (data) data->serializeOp(*this);