SeqAn3  3.1.0
The Modern C++ library for sequence analysis.
core_language.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 <seqan3/std/concepts>
16 #include <type_traits>
17 
18 #include <seqan3/core/platform.hpp>
19 
20 namespace seqan3::detail
21 {
29 template <class T, class U>
30 SEQAN3_CONCEPT weakly_equality_comparable_with =
31  requires(std::remove_reference_t<T> const & t,
33  {
34  std::convertible_to<decltype(t == u), bool>;
35  std::convertible_to<decltype(t != u), bool>;
36  std::convertible_to<decltype(u == t), bool>;
37  std::convertible_to<decltype(u != t), bool>;
38  };
40 
43 template <typename lhs_t, typename rhs_t>
44 struct weakly_equality_comparable_with_trait :
45  std::integral_constant<bool, weakly_equality_comparable_with<lhs_t, rhs_t>>
46 {};
47 
55 template <typename t1, typename t2>
56 SEQAN3_CONCEPT weakly_ordered_with = requires (std::remove_reference_t<t1> const & v1,
57  std::remove_reference_t<t2> const & v2)
58 {
59  std::convertible_to<decltype(v1 < v2), bool>;
60  std::convertible_to<decltype(v1 <= v2), bool>;
61  std::convertible_to<decltype(v1 > v2), bool>;
62  std::convertible_to<decltype(v1 >= v2), bool>;
63 
64  std::convertible_to<decltype(v2 < v1), bool>;
65  std::convertible_to<decltype(v2 <= v1), bool>;
66  std::convertible_to<decltype(v2 > v1), bool>;
67  std::convertible_to<decltype(v2 >= v1), bool>;
68 };
70 
73 template <typename lhs_t, typename rhs_t>
74 struct weakly_ordered_with_trait : std::integral_constant<bool, weakly_ordered_with<lhs_t, rhs_t>>
75 {};
76 
77 } // seqan3::detail
78 
79 namespace seqan3
80 {
90 template <typename t, typename u>
91 SEQAN3_CONCEPT implicitly_convertible_to = std::is_convertible_v<t, u>;
93 
103 template <typename t, typename u>
104 SEQAN3_CONCEPT explicitly_convertible_to = requires (t vt) { { static_cast<u>(vt)}; };
106 
118 template <typename t>
119 SEQAN3_CONCEPT arithmetic = std::is_arithmetic_v<t>;
121 
134 template <typename t>
135 SEQAN3_CONCEPT floating_point = arithmetic<t> && std::is_floating_point_v<t>;
137 
149 
150 template <typename t>
151 SEQAN3_CONCEPT builtin_character = std::integral<t> &&
152  (std::same_as<t, char> || std::same_as<t, unsigned char> || std::same_as<t, signed char> ||
153 #ifdef __cpp_char8_t
154  std::same_as<t, char8_t> ||
155 #endif
156  std::same_as<t, char16_t> || std::same_as<t, char32_t> || std::same_as<t, wchar_t>);
158 
171 template <typename t>
172 SEQAN3_CONCEPT trivially_destructible = std::destructible<t> && std::is_trivially_destructible_v<t>;
174 
187 template <typename t>
188 SEQAN3_CONCEPT trivially_copyable = std::copyable<t> && std::is_trivially_copyable_v<t>;
190 
204 template <typename t>
205 SEQAN3_CONCEPT trivial = trivially_copyable<t> && trivially_destructible<t> && std::is_trivial_v<t>;
207 
219 template <typename t>
220 SEQAN3_CONCEPT standard_layout = std::is_standard_layout_v<t>;
222 
237 template <typename t, typename u>
238 SEQAN3_CONCEPT weakly_assignable_from = std::is_assignable_v<t, u>;
240 } // namespace seqan3
The <concepts> header from C++20's standard library.
A type that satisfies std::is_arithmetic_v<t>.
This concept encompasses exactly the types char, signed char, unsigned char, wchar_t,...
Resolves to std::ranges::explicitly_convertible_to<type1, type2>().
An arithmetic type that also satisfies std::is_floating_point_v<t>.
Resolves to std::ranges::implicitly_convertible_to<type1, type2>().
Resolves to std::is_standard_layout_v<t>.
A type that satisfies seqan3::trivially_copyable and seqan3::trivially_destructible.
A type that satisfies std::is_trivially_copyable_v<t>.
A type that satisfies std::is_trivially_destructible_v<t>.
Resolves to std::is_assignable_v<t>.
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
Provides platform and dependency checks.