SeqAn3  3.2.0-rc.1
The Modern C++ library for sequence analysis.
basic.hpp
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------------------------------
2 // Copyright (c) 2006-2022, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2022, Knut Reinert & MPI für molekulare Genetik
4 // This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License
5 // shipped with this file and also available at: https://github.com/seqan/seqan3/blob/master/LICENSE.md
6 // -----------------------------------------------------------------------------------------------------
7 
13 #pragma once
14 
15 #include <tuple>
16 #include <type_traits>
17 
18 #include <seqan3/core/platform.hpp>
19 
20 // ----------------------------------------------------------------------------
21 // is_constexpr
22 // ----------------------------------------------------------------------------
23 
25 
29 #define SEQAN3_IS_CONSTEXPR(...) std::integral_constant<bool, __builtin_constant_p((__VA_ARGS__, 0))>::value
31 
32 namespace seqan3
33 {
34 
35 // ----------------------------------------------------------------------------
36 // remove_rvalue_reference
37 // ----------------------------------------------------------------------------
38 
45 template <typename t>
47 {
50 };
51 
57 template <typename t>
59 
60 // ----------------------------------------------------------------------------
61 // is_constexpr_default_constructible
62 // ----------------------------------------------------------------------------
63 
69 template <typename t>
71 {};
72 
74 template <typename t>
75  requires std::is_default_constructible_v<t>
76 struct is_constexpr_default_constructible<t> : std::integral_constant<bool, SEQAN3_IS_CONSTEXPR(t{})>
77 {};
79 
84 template <typename t>
85 inline constexpr bool is_constexpr_default_constructible_v = is_constexpr_default_constructible<t>::value;
86 
87 } // namespace seqan3
88 
89 namespace seqan3::detail
90 {
91 
92 // ----------------------------------------------------------------------------
93 // deferred_type
94 // ----------------------------------------------------------------------------
95 
103 template <typename t, typename... dependent_ts>
104 struct deferred_type
105 {
107  using type = t;
108 };
109 
117 template <typename t, typename... dependent_ts>
118 using deferred_type_t = typename deferred_type<t, dependent_ts...>::type;
119 
120 // ----------------------------------------------------------------------------
121 // ignore_t
122 // ----------------------------------------------------------------------------
123 
126 using ignore_t = std::remove_cvref_t<decltype(std::ignore)>;
127 
133 template <typename t>
134 constexpr bool decays_to_ignore_v = std::is_same_v<std::remove_cvref_t<t>, ignore_t>;
135 
136 } // namespace seqan3::detail
137 
138 // ----------------------------------------------------------------------------
139 // SEQAN3_IS_SAME
140 // ----------------------------------------------------------------------------
141 
143 
147 #if defined(__clang__)
148 # define SEQAN3_IS_SAME(...) __is_same(__VA_ARGS__)
149 #elif defined(__GNUC__)
150 # define SEQAN3_IS_SAME(...) __is_same_as(__VA_ARGS__)
151 #else
152 # define SEQAN3_IS_SAME(...) std::is_same_v<__VA_ARGS__>
153 #endif
requires requires
The rank_type of the semi-alphabet; defined as the return type of seqan3::to_rank....
Definition: alphabet/concept.hpp:164
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
Provides platform and dependency checks.
Whether a type std::is_default_constructible in constexpr-context (unary_type_trait specialisation).
Definition: basic.hpp:71
Return the input type with && removed, but lvalue references preserved.
Definition: basic.hpp:47
typename remove_rvalue_reference< t >::type remove_rvalue_reference_t
Return the input type with && removed, but lvalue references preserved (transformation_trait shortcut...
Definition: basic.hpp:58