diff --git a/src/utils/cached.h b/src/utils/cached.h index f76ade8c1..b25f1b3a6 100644 --- a/src/utils/cached.h +++ b/src/utils/cached.h @@ -1,58 +1,58 @@ /* -*- mode: c++; c-basic-offset:4 -*- utils/cached.h This file is part of Kleopatra, the KDE keymanager SPDX-FileCopyrightText: 2009 Klarälvdalens Datakonsult AB SPDX-License-Identifier: GPL-2.0-or-later */ #pragma once #include namespace Kleo { template class cached { T m_value; bool m_dirty; - using CallType = const typename std::conditional::value, T, T&>::type; + using CallType = const typename std::conditional::value && std::is_trivial::value, T, T&>::type; public: cached() : m_value(), m_dirty(true) {} /* implicit */ cached(const CallType value) : m_value(value), m_dirty(false) {} operator T() const { return m_value; } cached &operator=(T value) { m_value = value; m_dirty = false; return *this; } bool dirty() const { return m_dirty; } T value() const { return m_value; } void set_dirty() { m_dirty = true; } }; }