Line |
Branch |
Exec |
Source |
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 |
|
|
// |
7 |
|
|
/*! |
8 |
|
|
* \file |
9 |
|
|
* \ingroup Typetraits |
10 |
|
|
* \brief Type traits. |
11 |
|
|
*/ |
12 |
|
|
#ifndef DUMUX_TYPE_TRAITS_HH |
13 |
|
|
#define DUMUX_TYPE_TRAITS_HH |
14 |
|
|
|
15 |
|
|
#include <type_traits> |
16 |
|
|
|
17 |
|
|
namespace Dumux { |
18 |
|
|
|
19 |
|
|
/*! |
20 |
|
|
* \brief Template which always yields a false value |
21 |
|
|
* \tparam T Some type. |
22 |
|
|
*/ |
23 |
|
|
template<typename T> |
24 |
|
|
struct AlwaysFalse : public std::false_type {}; |
25 |
|
|
|
26 |
|
|
/*! |
27 |
|
|
* \brief Function that performs no operation. |
28 |
|
|
*/ |
29 |
|
✗ |
inline constexpr auto noop = [] (auto...) {}; |
30 |
|
|
using Noop = decltype(noop); |
31 |
|
|
|
32 |
|
|
/*! |
33 |
|
|
* \brief Helper template to select type T if it is not void |
34 |
|
|
* or fall back to the given default type otherwise. |
35 |
|
|
*/ |
36 |
|
|
template<typename Default, typename T> |
37 |
|
|
using NonVoidOr = std::conditional_t<!std::is_void_v<T>, T, Default>; |
38 |
|
|
|
39 |
|
|
} // end namespace Dumux |
40 |
|
|
|
41 |
|
|
#endif |
42 |
|
|
|