Dune Core Modules (2.9.1)

typeutilities.hh
Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
5#ifndef DUNE_COMMON_TYPEUTILITIES_HH
6#define DUNE_COMMON_TYPEUTILITIES_HH
7
8#include <cstddef>
9#include <type_traits>
10#include <tuple>
11
12
13namespace Dune {
14
22 namespace Impl
23 {
24
25 template<class This, class... T>
26 struct disableCopyMoveHelper : public std::is_base_of<This, std::tuple_element_t<0, std::tuple<std::decay_t<T>...>>>
27 {};
28
29 template<class This>
30 struct disableCopyMoveHelper<This> : public std::false_type
31 {};
32
33 } // namespace Impl
34
35
44 template<class This, class... T>
45 using disableCopyMove = std::enable_if_t< not Impl::disableCopyMoveHelper<This, T...>::value, int>;
46
47
48
71 template<std::size_t priority>
72 struct PriorityTag : public PriorityTag<priority-1>
73 {
74 static constexpr std::size_t value = priority;
75 };
76
85 template<>
86 struct PriorityTag<0>
87 {
88 static constexpr std::size_t value = 0;
89 };
90
91
92
93} // namespace Dune
94
95
96
97#endif // DUNE_COMMON_TYPEUTILITIES_HH
std::enable_if_t< not Impl::disableCopyMoveHelper< This, T... >::value, int > disableCopyMove
Helper to disable constructor as copy and move constructor.
Definition: typeutilities.hh:45
Dune namespace.
Definition: alignedallocator.hh:13
Helper class for tagging priorities.
Definition: typeutilities.hh:73
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 21, 23:30, 2024)