SeqAn3  3.0.0
The Modern C++ library for sequence analysis.
core_language.hpp
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------------------------------
2 // Copyright (c) 2006-2019, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2019, 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 #include <seqan3/std/ranges>
20 
21 namespace seqan3::detail
22 {
23 
31 template <typename lhs_t, typename rhs_t>
33 SEQAN3_CONCEPT WeaklyEqualityComparableByMembersWith = requires (lhs_t const & lhs, rhs_t const & rhs)
34 {
35  lhs.operator==(rhs); std::Boolean<decltype(lhs.operator==(rhs))>;
36  lhs.operator!=(rhs); std::Boolean<decltype(lhs.operator!=(rhs))>;
37 };
39 
42 template <typename lhs_t, typename rhs_t>
44 SEQAN3_CONCEPT WeaklyOrderedByMembersWith = requires (lhs_t const & lhs, rhs_t const & rhs)
45 {
46  lhs.operator< (rhs); std::Boolean<decltype(lhs.operator< (rhs))>;
47  lhs.operator> (rhs); std::Boolean<decltype(lhs.operator> (rhs))>;
48  lhs.operator<=(rhs); std::Boolean<decltype(lhs.operator<=(rhs))>;
49  lhs.operator>=(rhs); std::Boolean<decltype(lhs.operator>=(rhs))>;
50 };
52 
56 template <typename source_t, typename target_t>
58 SEQAN3_CONCEPT ConvertibleToByMember = requires (source_t s)
59 {
60  { s.operator target_t() } -> target_t;
61 };
64 
65 } // seqan3::detail
66 
67 namespace seqan3
68 {
69 
80 template <typename t1, typename t2>
82 SEQAN3_CONCEPT WeaklyOrderedWith = requires (std::remove_reference_t<t1> const & v1,
83  std::remove_reference_t<t2> const & v2)
84 {
85  { v1 < v2 } -> bool &&;
86  { v1 <= v2 } -> bool &&;
87  { v2 > v1 } -> bool &&;
88  { v2 >= v1 } -> bool &&;
89 };
91 
95 template <typename t, typename u>
97 SEQAN3_CONCEPT ImplicitlyConvertibleTo = std::is_convertible_v<t, u>;
99 
103 template <typename t, typename u>
105 SEQAN3_CONCEPT ExplicitlyConvertibleTo = requires (t vt) { { static_cast<u>(vt)}; };
107 
112 template <typename t>
114 SEQAN3_CONCEPT Arithmetic = std::is_arithmetic_v<t>;
116 
122 template <typename t>
124 SEQAN3_CONCEPT FloatingPoint = Arithmetic<t> && std::is_floating_point_v<t>;
126 
132 
134 template <typename t>
135 SEQAN3_CONCEPT Char = std::Integral<t> &&
137 #ifdef __cpp_char8_t
139 #endif
142 
148 template <typename t>
150 SEQAN3_CONCEPT TriviallyDestructible = std::Destructible<t> && std::is_trivially_destructible_v<t>;
152 
158 template <typename t>
160 SEQAN3_CONCEPT TriviallyCopyable = std::Copyable<t> && std::is_trivially_copyable_v<t>;
162 
169 template <typename t>
171 SEQAN3_CONCEPT Trivial = TriviallyCopyable<t> && TriviallyDestructible<t> && std::is_trivial_v<t>;
173 
178 template <typename t>
180 SEQAN3_CONCEPT StandardLayout = std::is_standard_layout_v<t>;
182 
192 template <typename t, typename u>
194 SEQAN3_CONCEPT WeaklyAssignable = std::is_assignable_v<t, u>;
196 
197 } // namespace seqan3
Provides platform and dependency checks.
The main SeqAn3 namespace.
The concept std::Destructible specifies the concept of all types whose instances can safely be destro...
The Concepts library.
Adaptations of concepts from the Ranges TS.
Specifies that a type can be used in Boolean contexts.
Definition: aligned_sequence_concept.hpp:35
Subsumes std::Movable, std::CopyConstructible, and requires that the type be std::Assignable bool fro...
The concept std::Same<T, U> is satisfied if and only if T and U denote the same type.
The concept Integral is satisfied if and only if T is an integral type.