TRIQS/TRIQS
4.0.0
Researching Interacting Quantum Systems
Loading...
Searching...
No Matches
concept_tools.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 <boost/preprocessor/punctuation/comma_if.hpp>
28
#include <boost/preprocessor/seq/for_each_i.hpp>
29
30
#include <type_traits>
31
36
38
#define TRIQS_CONCEPT_TAG_NAME(MyBeautifulConcept) MyBeautifulConcept##__concept_tag
39
50
#define TRIQS_DEFINE_CONCEPT_AND_ASSOCIATED_TRAIT(MyBeautifulConcept) \
51
struct TRIQS_CONCEPT_TAG_NAME(MyBeautifulConcept) {}; \
52
template <typename T> struct MyBeautifulConcept : std::is_base_of<TRIQS_CONCEPT_TAG_NAME(MyBeautifulConcept), T> {}; \
53
template <typename T> struct MyBeautifulConcept<const T> : MyBeautifulConcept<T> {}; \
54
template <typename T> struct MyBeautifulConcept<T &> : MyBeautifulConcept<T> {}; \
55
template <typename T> struct MyBeautifulConcept<T &&> : MyBeautifulConcept<T> {}; \
56
template <typename T> \
57
constexpr bool MyBeautifulConcept##_v = std::is_base_of<TRIQS_CONCEPT_TAG_NAME(MyBeautifulConcept), typename std::decay<T>::type>::value;
58
60
#define TRIQS_DEFINE_CONCEPT_AND_ASSOCIATED_TRAIT_R_AUX(r, data, i, elem) BOOST_PP_COMMA_IF(i) TRIQS_CONCEPT_TAG_NAME(elem)
61
66
#define TRIQS_DEFINE_CONCEPT_AND_ASSOCIATED_TRAIT_R(MyBeautifulConcept, Rs) \
67
struct TRIQS_CONCEPT_TAG_NAME(MyBeautifulConcept) : BOOST_PP_SEQ_FOR_EACH_I(TRIQS_DEFINE_CONCEPT_AND_ASSOCIATED_TRAIT_R_AUX, nil, Rs) {}; \
68
template <typename T> struct MyBeautifulConcept : std::is_base_of<TRIQS_CONCEPT_TAG_NAME(MyBeautifulConcept), T> {}; \
69
template <typename T> struct MyBeautifulConcept<const T> : MyBeautifulConcept<T> {}; \
70
template <typename T> struct MyBeautifulConcept<T &> : MyBeautifulConcept<T> {}; \
71
template <typename T> struct MyBeautifulConcept<T &&> : MyBeautifulConcept<T> {}; \
72
template <typename T> \
73
constexpr bool MyBeautifulConcept##_v = std::is_base_of<TRIQS_CONCEPT_TAG_NAME(MyBeautifulConcept), typename std::decay<T>::type>::value;
74
triqs
utility
concept_tools.hpp
Generated by
1.15.0