mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
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:
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user