SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
basic.hpp
Go to the documentation of this file.
1// -----------------------------------------------------------------------------------------------------
2// Copyright (c) 2006-2023, Knut Reinert & Freie Universität Berlin
3// Copyright (c) 2016-2023, 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
19
20// ----------------------------------------------------------------------------
21// is_constexpr
22// ----------------------------------------------------------------------------
23
25
29#if defined(__clang__) // https://github.com/llvm/llvm-project/issues/58078
30# define SEQAN3_IS_CONSTEXPR(...) true
31#else
32# define SEQAN3_IS_CONSTEXPR(...) std::integral_constant<bool, __builtin_constant_p(((void)__VA_ARGS__, 0))>::value
33#endif
35
36namespace seqan3
37{
38
39// ----------------------------------------------------------------------------
40// remove_rvalue_reference
41// ----------------------------------------------------------------------------
42
49template <typename t>
55
61template <typename t>
63
64// ----------------------------------------------------------------------------
65// is_constexpr_default_constructible
66// ----------------------------------------------------------------------------
67
73template <typename t>
76
78template <typename t>
79 requires std::is_default_constructible_v<t>
80struct is_constexpr_default_constructible<t> : std::integral_constant<bool, SEQAN3_IS_CONSTEXPR(t{})>
81{};
83
88template <typename t>
89inline constexpr bool is_constexpr_default_constructible_v = is_constexpr_default_constructible<t>::value;
90
91} // namespace seqan3
92
93namespace seqan3::detail
94{
95
96// ----------------------------------------------------------------------------
97// deferred_type
98// ----------------------------------------------------------------------------
99
107template <typename t, typename... dependent_ts>
108struct deferred_type
109{
111 using type = t;
112};
113
121template <typename t, typename... dependent_ts>
122using deferred_type_t = typename deferred_type<t, dependent_ts...>::type;
123
124// ----------------------------------------------------------------------------
125// ignore_t
126// ----------------------------------------------------------------------------
127
130using ignore_t = std::remove_cvref_t<decltype(std::ignore)>;
131
137template <typename t>
138constexpr bool decays_to_ignore_v = std::is_same_v<std::remove_cvref_t<t>, ignore_t>;
139
140} // namespace seqan3::detail
141
142// ----------------------------------------------------------------------------
143// SEQAN3_IS_SAME
144// ----------------------------------------------------------------------------
145
147
151#if defined(__clang__)
152# define SEQAN3_IS_SAME(...) __is_same(__VA_ARGS__)
153#elif defined(__GNUC__)
154# define SEQAN3_IS_SAME(...) __is_same_as(__VA_ARGS__)
155#else
156# define SEQAN3_IS_SAME(...) std::is_same_v<__VA_ARGS__>
157#endif
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:75
Return the input type with && removed, but lvalue references preserved.
Definition basic.hpp:51
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:62