Simplify ptr(), avoiding a template template parameter.

Since unique_ptr<T, Deleter> takes two arguments it cannot strictly
speaking be used via a template template parameter that takes one,
even though the second has a default. GCC allows this anyway, but
not clang.
This commit is contained in:
Atgeirr Flø Rasmussen
2020-03-23 11:55:45 +01:00
parent 53d636a3b1
commit 652c7d239b

View File

@@ -278,13 +278,14 @@ protected:
//! \brief Handler for smart pointers. //! \brief Handler for smart pointers.
//! \details If data is POD or a string, we pass it to the underlying serializer, //! \details If data is POD or a string, we pass it to the underlying serializer,
//! if not we assume a complex type. //! if not we assume a complex type.
template<template<class T> class PtrType, class T1> template<class PtrType>
void ptr(const PtrType<T1>& data) void ptr(const PtrType& data)
{ {
using T1 = typename PtrType::element_type;
bool value = data ? true : false; bool value = data ? true : false;
(*this)(value); (*this)(value);
if (m_op == Operation::UNPACK && value) { if (m_op == Operation::UNPACK && value) {
const_cast<PtrType<T1>&>(data).reset(new T1); const_cast<PtrType&>(data).reset(new T1);
} }
if (data) if (data)
data->serializeOp(*this); data->serializeOp(*this);