version 3.10-dev
common/typetraits/typetraits.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3//
4// SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
12#ifndef DUMUX_TYPE_TRAITS_HH
13#define DUMUX_TYPE_TRAITS_HH
14
15#include <type_traits>
16
17namespace Dumux {
18
23template<typename T>
24struct AlwaysFalse : public std::false_type {};
25
29inline constexpr auto noop = [] (auto...) {};
30using Noop = decltype(noop);
31
36template<typename Default, typename T>
37using NonVoidOr = std::conditional_t<!std::is_void_v<T>, T, Default>;
38
39} // end namespace Dumux
40
41#endif
Definition: adapt.hh:17
constexpr auto noop
Function that performs no operation.
Definition: common/typetraits/typetraits.hh:29
std::conditional_t<!std::is_void_v< T >, T, Default > NonVoidOr
Helper template to select type T if it is not void or fall back to the given default type otherwise.
Definition: common/typetraits/typetraits.hh:37
decltype(noop) Noop
Definition: common/typetraits/typetraits.hh:30
Template which always yields a false value.
Definition: common/typetraits/typetraits.hh:24