SeqAn3  3.1.0-rc.1
The Modern C++ library for sequence analysis.
basic.hpp
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------------------------------
2 // Copyright (c) 2006-2021, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2021, 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 <seqan3/std/type_traits>
17 
18 #include <seqan3/core/platform.hpp>
19 
20 // ----------------------------------------------------------------------------
21 // is_constexpr
22 // ----------------------------------------------------------------------------
23 
28 #define SEQAN3_IS_CONSTEXPR(...) std::integral_constant<bool, __builtin_constant_p((__VA_ARGS__, 0))>::value
29 
30 namespace seqan3
31 {
32 
33 // ----------------------------------------------------------------------------
34 // remove_rvalue_reference
35 // ----------------------------------------------------------------------------
36 
43 template <typename t>
45 {
47  using type = std::conditional_t<std::is_rvalue_reference_v<t>, std::remove_reference_t<t>, t>;
48 };
49 
55 template <typename t>
57 
58 // ----------------------------------------------------------------------------
59 // is_constexpr_default_constructible
60 // ----------------------------------------------------------------------------
61 
67 template <typename t>
68 struct is_constexpr_default_constructible : std::false_type
69 {};
70 
76 template <typename t>
78  requires std::is_default_constructible_v<t>
80 struct is_constexpr_default_constructible<t> : std::integral_constant<bool, SEQAN3_IS_CONSTEXPR(t{})>
81 {};
82 
87 template <typename t>
88 inline constexpr bool is_constexpr_default_constructible_v = is_constexpr_default_constructible<t>::value;
89 
90 } // namespace seqan3
91 
92 namespace seqan3::detail
93 {
94 
95 // ----------------------------------------------------------------------------
96 // deferred_type
97 // ----------------------------------------------------------------------------
98 
106 template <typename t, typename ...dependent_ts>
107 struct deferred_type
108 {
110  using type = t;
111 };
112 
120 template <typename t, typename ...dependent_ts>
121 using deferred_type_t = typename deferred_type<t, dependent_ts...>::type;
122 
123 // ----------------------------------------------------------------------------
124 // ignore_t
125 // ----------------------------------------------------------------------------
126 
129 using ignore_t = std::remove_cvref_t<decltype(std::ignore)>;
130 
136 template <typename t>
137 constexpr bool decays_to_ignore_v = std::is_same_v<std::remove_cvref_t<t>, ignore_t>;
138 
139 } // namespace seqan3::detail
140 
141 // ----------------------------------------------------------------------------
142 // SEQAN3_IS_SAME
143 // ----------------------------------------------------------------------------
144 
149 #if defined(__clang__)
150 # define SEQAN3_IS_SAME(...) __is_same(__VA_ARGS__)
151 #elif defined(__GNUC__)
152 # define SEQAN3_IS_SAME(...) __is_same_as(__VA_ARGS__)
153 #else
154 # define SEQAN3_IS_SAME(...) std::is_same_v<__VA_ARGS__>
155 #endif
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
typename remove_cvref< t >::type remove_cvref_t
Return the input type with const, volatile and references removed (transformation_trait shortcut).
Definition: type_traits:54
Provides platform and dependency checks.
Whether a type std::is_default_constructible in constexpr-context.
Definition: basic.hpp:69
Return the input type with && removed, but lvalue references preserved.
Definition: basic.hpp:45
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:56
std::conditional_t< std::is_rvalue_reference_v< t >, std::remove_reference_t< t >, t > type
The return type is the input type with any && stripped.
Definition: basic.hpp:47
Provides C++20 additions to the type_traits header.