SeqAn3  3.0.1
The Modern C++ library for sequence analysis.
core_language.hpp
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------------------------------
2 // Copyright (c) 2006-2020, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2020, 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 <type_traits>
16 
17 #include <seqan3/core/platform.hpp>
18 #include <seqan3/std/concepts>
19 
20 namespace seqan3::detail
21 {
22 
32 template <class T, class U>
34 SEQAN3_CONCEPT weakly_equality_comparable_with =
35  requires(std::remove_reference_t<T> const & t,
37  {
38  std::convertible_to<decltype(t == u), bool>;
39  std::convertible_to<decltype(t != u), bool>;
40  std::convertible_to<decltype(u == t), bool>;
41  std::convertible_to<decltype(u != t), bool>;
42  };
44 
46 template <typename lhs_t, typename rhs_t>
47 struct weakly_equality_comparable_with_trait :
48  std::integral_constant<bool, weakly_equality_comparable_with<lhs_t, rhs_t>>
49 {};
50 
56 template <typename t1, typename t2>
58 SEQAN3_CONCEPT weakly_ordered_with = requires (std::remove_reference_t<t1> const & v1,
59  std::remove_reference_t<t2> const & v2)
60 {
61  std::convertible_to<decltype(v1 < v2), bool>;
62  std::convertible_to<decltype(v1 <= v2), bool>;
63  std::convertible_to<decltype(v1 > v2), bool>;
64  std::convertible_to<decltype(v1 >= v2), bool>;
65 
66  std::convertible_to<decltype(v2 < v1), bool>;
67  std::convertible_to<decltype(v2 <= v1), bool>;
68  std::convertible_to<decltype(v2 > v1), bool>;
69  std::convertible_to<decltype(v2 >= v1), bool>;
70 };
72 
74 template <typename lhs_t, typename rhs_t>
75 struct weakly_ordered_with_trait : std::integral_constant<bool, weakly_ordered_with<lhs_t, rhs_t>>
76 {};
77 
79 
80 } // seqan3::detail
81 
82 namespace seqan3
83 {
84 
92 template <typename t, typename u>
94 SEQAN3_CONCEPT implicitly_convertible_to = std::is_convertible_v<t, u>;
96 
100 template <typename t, typename u>
102 SEQAN3_CONCEPT explicitly_convertible_to = requires (t vt) { { static_cast<u>(vt)}; };
104 
109 template <typename t>
111 SEQAN3_CONCEPT arithmetic = std::is_arithmetic_v<t>;
113 
119 template <typename t>
121 SEQAN3_CONCEPT floating_point = arithmetic<t> && std::is_floating_point_v<t>;
123 
129 
131 template <typename t>
132 SEQAN3_CONCEPT builtin_character = std::integral<t> &&
134 #ifdef __cpp_char8_t
136 #endif
139 
145 template <typename t>
147 SEQAN3_CONCEPT trivially_destructible = std::destructible<t> && std::is_trivially_destructible_v<t>;
149 
155 template <typename t>
157 SEQAN3_CONCEPT trivially_copyable = std::copyable<t> && std::is_trivially_copyable_v<t>;
159 
166 template <typename t>
168 SEQAN3_CONCEPT trivial = trivially_copyable<t> && trivially_destructible<t> && std::is_trivial_v<t>;
170 
175 template <typename t>
177 SEQAN3_CONCEPT standard_layout = std::is_standard_layout_v<t>;
179 
189 template <typename t, typename u>
191 SEQAN3_CONCEPT weakly_assignable_from = std::is_assignable_v<t, u>;
193 
194 } // namespace seqan3
trivial
A type that satisfies seqan3::trivially_copyable and seqan3::trivially_destructible.
standard_layout
Resolves to std::is_standard_layout_v<t>.
std::integral_constant
explicitly_convertible_to
Resolves to std::ranges::explicitly_convertible_to<type1, type2>().
floating_point
An arithmetic type that also satisfies std::is_floating_point_v<t>.
concepts
The Concepts library.
same_as
The concept std::same_as<T, U> is satisfied if and only if T and U denote the same type.
builtin_character
This concept encompasses exactly the types char, signed char, unsigned char, wchar_t,...
seqan3
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:36
copyable
Subsumes std::movable, std::copy_constructible, and requires that the type be std::assignable_from bo...
convertible_to
The concept std::convertible_to<From, To> specifies that an expression of the type and value category...
std::remove_reference_t
destructible
The concept std::destructible specifies the concept of all types whose instances can safely be destro...
platform.hpp
Provides platform and dependency checks.
trivially_copyable
A type that satisfies std::is_trivially_copyable_v<t>.
weakly_assignable_from
Resolves to std::is_assignable_v<t>.
implicitly_convertible_to
Resolves to std::ranges::implicitly_convertible_to<type1, type2>().
arithmetic
A type that satisfies std::is_arithmetic_v<t>.
integral
The concept integral is satisfied if and only if T is an integral type.
trivially_destructible
A type that satisfies std::is_trivially_destructible_v<t>.