SeqAn3 3.1.0
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>
17
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
32namespace seqan3
33{
34
35// ----------------------------------------------------------------------------
36// remove_rvalue_reference
37// ----------------------------------------------------------------------------
38
45template <typename t>
47{
50};
51
57template <typename t>
59
60// ----------------------------------------------------------------------------
61// is_constexpr_default_constructible
62// ----------------------------------------------------------------------------
63
69template <typename t>
71{};
72
74template <typename t>
75 requires std::is_default_constructible_v<t>
76struct is_constexpr_default_constructible<t> : std::integral_constant<bool, SEQAN3_IS_CONSTEXPR(t{})>
77{};
79
84template <typename t>
85inline constexpr bool is_constexpr_default_constructible_v = is_constexpr_default_constructible<t>::value;
86
87} // namespace seqan3
88
89namespace seqan3::detail
90{
91
92// ----------------------------------------------------------------------------
93// deferred_type
94// ----------------------------------------------------------------------------
95
103template <typename t, typename ...dependent_ts>
104struct deferred_type
105{
107 using type = t;
108};
109
117template <typename t, typename ...dependent_ts>
118using deferred_type_t = typename deferred_type<t, dependent_ts...>::type;
119
120// ----------------------------------------------------------------------------
121// ignore_t
122// ----------------------------------------------------------------------------
123
126using ignore_t = std::remove_cvref_t<decltype(std::ignore)>;
127
133template <typename t>
134constexpr 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
The main SeqAn3 namespace.
Definition: cigar_operation_table.hpp:2
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
The <type_traits> header from C++20's standard library.