TRIQS/TRIQS 4.0.0
Researching Interacting Quantum Systems
Loading...
Searching...
No Matches
traits.hpp
Go to the documentation of this file.
1// Copyright (c) 2013-2018 Commissariat à l'énergie atomique et aux énergies alternatives (CEA)
2// Copyright (c) 2013-2018 Centre national de la recherche scientifique (CNRS)
3// Copyright (c) 2018 Simons Foundation
4//
5// This program is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You may obtain a copy of the License at
16// https://www.gnu.org/licenses/gpl-3.0.txt
17//
18// Authors: Olivier Parcollet, Nils Wentzell
19
24
25#pragma once
26
27#include <type_traits>
28
29namespace triqs {
30
35
40 template <typename... T> struct _or;
41 template <typename T0, typename... T> struct _or<T0, T...> : std::integral_constant<bool, T0::value || _or<T...>::value> {};
42 template <> struct _or<> : std::false_type {};
43
48 template <typename... T> struct _and;
49 template <typename T0, typename... T> struct _and<T0, T...> : std::integral_constant<bool, T0::value && _and<T...>::value> {};
50 template <> struct _and<> : std::true_type {};
51
56 template <bool B> using bool_constant = std::integral_constant<bool, B>;
57
63 template <typename T> struct remove_cv_ref : std::remove_cv<std::remove_reference_t<T>> {};
64
68 struct is_view_tag {};
69
74 template <typename T> struct is_view : std::is_base_of<is_view_tag, T> {};
75
77
78} // namespace triqs
std::integral_constant< bool, B > bool_constant
Alias for std::integral_constant<bool, B>.
Definition traits.hpp:56
Boolean AND fold over a parameter pack of integral_constant-like traits.
Definition traits.hpp:48
Boolean OR fold over a parameter pack of integral_constant-like traits.
Definition traits.hpp:40
Empty tag inherited by every view type in TRIQS. See also is_view.
Definition traits.hpp:68
Trait that detects view types by checking for inheritance from is_view_tag.
Definition traits.hpp:74
Strip cv- and reference-qualifiers from a type.
Definition traits.hpp:63