From a9eb6159aed381f89f69551ed3ecf59afa3c505d Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 2 Sep 2022 12:57:30 +0200 Subject: [PATCH] eclmpiserializer: improve pair handling use has_serializeOp trait --- ebos/eclmpiserializer.hh | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/ebos/eclmpiserializer.hh b/ebos/eclmpiserializer.hh index e91c09c7b..d11027c04 100644 --- a/ebos/eclmpiserializer.hh +++ b/ebos/eclmpiserializer.hh @@ -480,20 +480,18 @@ protected: > : public std::true_type {}; //! \brief Handler for pairs. - //! \details If data is POD or a string, we pass it to the underlying serializer, - //! if not we assume a complex type. template void pair(const std::pair& data) { - if constexpr (std::is_pod::value || std::is_same::value) + if constexpr (has_serializeOp::value) + const_cast(data.first).serializeOp(*this); + else (*this)(data.first); - else - data.first.serializeOp(*this); - if constexpr (std::is_pod::value || std::is_same::value) - (*this)(data.second); - else + if constexpr (has_serializeOp::value) const_cast(data.second).serializeOp(*this); + else + (*this)(data.second); } //! \brief Handler for smart pointers.