SeqAn3
template_inspection.hpp
Go to the documentation of this file.
1 // ============================================================================
2 // SeqAn - The Library for Sequence Analysis
3 // ============================================================================
4 //
5 // Copyright (c) 2006-2018, Knut Reinert & Freie Universitaet Berlin
6 // Copyright (c) 2016-2018, Knut Reinert & MPI Molekulare Genetik
7 // All rights reserved.
8 //
9 // Redistribution and use in source and binary forms, with or without
10 // modification, are permitted provided that the following conditions are met:
11 //
12 // * Redistributions of source code must retain the above copyright
13 // notice, this list of conditions and the following disclaimer.
14 // * Redistributions in binary form must reproduce the above copyright
15 // notice, this list of conditions and the following disclaimer in the
16 // documentation and/or other materials provided with the distribution.
17 // * Neither the name of Knut Reinert or the FU Berlin nor the names of
18 // its contributors may be used to endorse or promote products derived
19 // from this software without specific prior written permission.
20 //
21 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 // ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE
25 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
31 // DAMAGE.
32 //
33 // ============================================================================
34 
40 #pragma once
41 
42 #include <meta/meta.hpp>
43 
45 
46 #include <seqan3/std/concepts>
47 
48 namespace seqan3::detail
49 {
50 
51 // ----------------------------------------------------------------------------
52 // transfer_template_args_onto
53 // ----------------------------------------------------------------------------
54 
56 template <typename source_type, template <typename ...> typename target_template>
57 struct transfer_template_args_onto
58 {};
60 
86 template <template <typename ...> typename source_template,
87  template <typename ...> typename target_template,
88  typename ... source_arg_types>
90  requires requires ()
91  {
92  std::declval<target_template<source_arg_types...>>();
93  }
95 struct transfer_template_args_onto<source_template<source_arg_types...>, target_template>
96 {
98  using type = target_template<source_arg_types...>;
99 };
100 
105 template <typename source_type, template <typename ...> typename target_template>
106 using transfer_template_args_onto_t = typename transfer_template_args_onto<source_type, target_template>::type;
107 
108 // ----------------------------------------------------------------------------
109 // transfer_template_vargs_onto
110 // ----------------------------------------------------------------------------
111 
113 template <typename source_type, template <auto ...> typename target_template>
114 struct transfer_template_vargs_onto
115 {};
117 
135 template <template <auto ...> typename source_template,
136  template <auto ...> typename target_template,
137  auto ... source_varg_types>
139  requires requires ()
140  {
141  std::declval<target_template<source_varg_types...>>();
142  }
144 struct transfer_template_vargs_onto<source_template<source_varg_types...>, target_template>
145 {
147  using type = target_template<source_varg_types...>;
148 };
149 
154 template <typename source_type, template <auto ...> typename target_template>
155 using transfer_template_vargs_onto_t = typename transfer_template_vargs_onto<source_type, target_template>::type;
156 
157 // ----------------------------------------------------------------------------
158 // is_type_specialisation_of_v
159 // ----------------------------------------------------------------------------
160 
174 template <typename source_t, template <typename ...> typename target_template>
175 struct is_type_specialisation_of : public std::false_type
176 {};
177 
178 template <typename source_t, template <typename ...> typename target_template>
181  void>
183 struct is_type_specialisation_of<source_t, target_template> :
184  std::is_same<source_t, transfer_template_args_onto_t<source_t, target_template>>
185 {};
186 
192 template <typename source_t, template <typename ...> typename target_template>
193 inline constexpr bool is_type_specialisation_of_v = is_type_specialisation_of<source_t, target_template>::value;
194 
195 // ----------------------------------------------------------------------------
196 // is_value_specialisation_of_v
197 // ----------------------------------------------------------------------------
198 
200 template <typename source_t, template <auto ...> typename target_template>
201 struct is_value_specialisation_of : std::false_type
202 {};
204 
213 template <typename source_t, template <auto ...> typename target_template>
216  void>
218 struct is_value_specialisation_of<source_t, target_template> :
219  std::is_same<source_t, transfer_template_vargs_onto_t<source_t, target_template>>
220 {};
221 
227 template <typename source_t, template <auto ...> typename target_template>
228 inline constexpr bool is_value_specialisation_of_v = is_value_specialisation_of<source_t, target_template>::value;
229 
230 } // namespace seqan3::detail
Provides seqan3::detail::transformation_trait_or.
The Concepts library.
The concept std::Same<T, U> is satisfied if and only if T and U denote the same type.
Definition: aligned_sequence_concept.hpp:288