BioC++ core-0.7.0
The Modern C++ libraries for Bioinformatics.
 
Loading...
Searching...
No Matches
detail.hpp
Go to the documentation of this file.
1// -----------------------------------------------------------------------------------------------------
2// Copyright (c) 2022 deCODE Genetics
3// Copyright (c) 2006-2021, Knut Reinert & Freie Universität Berlin
4// Copyright (c) 2016-2021, Knut Reinert & MPI für molekulare Genetik
5// This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License
6// shipped with this file and also available at: https://github.com/biocpp/biocpp-core/blob/main/LICENSE.md
7// -----------------------------------------------------------------------------------------------------
8
14#pragma once
15
19
20namespace bio::alphabet::detail
21{
22
23// ------------------------------------------------------------------
24// alphabet_tuple_like
25// ------------------------------------------------------------------
26
35template <typename t>
36concept alphabet_tuple_like = requires { requires t::biocpp_alphabet_tuple_like; };
37
38// ------------------------------------------------------------------
39// required_types
40// ------------------------------------------------------------------
41
51template <typename t>
52struct required_types
53{
55 using type = meta::type_list<>;
56};
57
67template <typename t>
68 requires(requires { typename t::biocpp_required_types; })
69struct required_types<t>
70{
72 using type = typename t::biocpp_required_types;
73};
74
78template <typename t>
79using required_types_t = typename required_types<t>::type;
80
81// ------------------------------------------------------------------
82// recursive_required_types
83// ------------------------------------------------------------------
84
85//TODO: This can be replaced with metaprogramming magic once a few more functions land in list_traits.
86
91template <typename t>
92struct recursive_required_types
93{
95 using type = meta::type_list<>;
96};
97
102template <typename t>
103 requires(requires { typename t::biocpp_recursive_required_types; })
104struct recursive_required_types<t>
105{
107 using type = typename t::biocpp_recursive_required_types;
108};
109
113template <typename t>
114using recursive_required_types_t = typename recursive_required_types<t>::type;
115
116// ------------------------------------------------------------------
117// Callable concept helpers for meta::invoke
118// ------------------------------------------------------------------
119
124template <typename T>
125struct constructible_from
126{
128 template <typename type>
130};
131
136template <typename T>
137struct implicitly_convertible_from
138{
140 template <typename type>
142};
143
148template <typename T>
149struct assignable_from
150{
152 template <typename type>
154};
155
160template <typename T>
161struct weakly_equality_comparable_with_
162{
164 template <typename type>
166};
167
172template <typename T>
173struct weakly_ordered_with_
174{
176 template <typename type>
178};
179
180// ------------------------------------------------------------------
181// Concept traits helper
182// ------------------------------------------------------------------
183
187template <typename lhs_t, typename rhs_t>
188struct weakly_equality_comparable_with_trait :
189 std::integral_constant<bool, meta::weakly_equality_comparable_with<lhs_t, rhs_t>>
190{};
191
195template <typename lhs_t, typename rhs_t>
196struct weakly_ordered_with_trait : std::integral_constant<bool, meta::weakly_ordered_with<lhs_t, rhs_t>>
197{};
198
199} // namespace bio::alphabet::detail
200
201// ------------------------------------------------------------------
202// Forwards
203// ------------------------------------------------------------------
204
205namespace bio::alphabet
206{
207
208// forward
209template <typename... alternative_types>
210 requires((detail::writable_constexpr_alphabet<alternative_types> && ...) &&
211 (std::regular<alternative_types> && ...) && (sizeof...(alternative_types) >= 2))
212class variant;
213
214template <typename derived_type, typename... component_types>
215 requires((detail::writable_constexpr_semialphabet<component_types> && ...) &&
216 (std::regular<component_types> && ...))
217class tuple_base;
218
219} // namespace bio::alphabet
Core alphabet concept and free function/type trait wrappers.
Provides concepts for core language types and relations that don't have concepts in C++20 (yet).
T invoke(T... args)
The alphabet module's namespace.
Definition: aa10li.hpp:23
Provides bio::meta::type_list.