Loading...
Searching...
No Matches
template_inspection.hpp
Go to the documentation of this file.
// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: BSD-3-Clause
#pragma once
#include <concepts>
#include <seqan3/utility/type_traits/detail/transformation_trait_or.hpp>
namespace seqan3::detail
{
// ----------------------------------------------------------------------------
// transfer_template_args_onto
// ----------------------------------------------------------------------------
template <typename source_type, template <typename...> typename target_template>
struct transfer_template_args_onto
{};
template <template <typename...> typename source_template,
template <typename...>
typename target_template,
typename... source_arg_types>
requires requires () { typename target_template<source_arg_types...>; }
struct transfer_template_args_onto<source_template<source_arg_types...>, target_template>
{
using type = target_template<source_arg_types...>;
};
template <typename source_type, template <typename...> typename target_template>
using transfer_template_args_onto_t = typename transfer_template_args_onto<source_type, target_template>::type;
// ----------------------------------------------------------------------------
// transfer_template_vargs_onto
// ----------------------------------------------------------------------------
template <typename source_type, template <auto...> typename target_template>
struct transfer_template_vargs_onto
{};
template <template <auto...> typename source_template,
template <auto...>
typename target_template,
auto... source_varg_types>
requires requires () { typename target_template<source_varg_types...>; }
struct transfer_template_vargs_onto<source_template<source_varg_types...>, target_template>
{
using type = target_template<source_varg_types...>;
};
template <typename source_type, template <auto...> typename target_template>
using transfer_template_vargs_onto_t = typename transfer_template_vargs_onto<source_type, target_template>::type;
// ----------------------------------------------------------------------------
// is_type_specialisation_of_v
// ----------------------------------------------------------------------------
template <typename source_t, template <typename...> typename target_template>
struct is_type_specialisation_of : public std::false_type
{};
template <template <typename...> typename source_t, typename... source_args>
struct is_type_specialisation_of<source_t<source_args...>, source_t> : public std::true_type
{};
template <typename source_t, template <typename...> typename target_template>
inline constexpr bool is_type_specialisation_of_v = is_type_specialisation_of<source_t, target_template>::value;
// ----------------------------------------------------------------------------
// is_value_specialisation_of_v
// ----------------------------------------------------------------------------
template <typename source_t, template <auto...> typename target_template>
struct is_value_specialisation_of : std::false_type
{};
template <template <auto...> typename source_t, auto... source_args>
struct is_value_specialisation_of<source_t<source_args...>, source_t> : public std::true_type
{};
template <typename source_t, template <auto...> typename target_template>
inline constexpr bool is_value_specialisation_of_v = is_value_specialisation_of<source_t, target_template>::value;
template <typename fallback_t, template <typename...> typename templ_t, typename... spec_t>
struct valid_template_spec_or
{
using type = fallback_t;
};
template <typename fallback_t, template <typename...> typename templ_t, typename... spec_t>
requires requires { typename templ_t<spec_t...>; }
struct valid_template_spec_or<fallback_t, templ_t, spec_t...>
{
using type = templ_t<spec_t...>;
};
template <typename fallback_t, template <typename...> typename templ_t, typename... spec_t>
using valid_template_spec_or_t = typename valid_template_spec_or<fallback_t, templ_t, spec_t...>::type;
// ----------------------------------------------------------------------------
// template_specialisation_of
// ----------------------------------------------------------------------------
template <typename mytype, template <typename...> typename type_template>
concept template_specialisation_of = is_type_specialisation_of_v<mytype, type_template>;
// ----------------------------------------------------------------------------
// strip_type_identity
// ----------------------------------------------------------------------------
template <typename t>
using strip_type_identity_t =
std::conditional_t<is_type_specialisation_of_v<t, std::type_identity>, transformation_trait_or_t<t, void>, t>;
} // namespace seqan3::detail
is_value_specialisation_of_v
constexpr bool is_value_specialisation_of_v
Helper variable template for seqan3::detail::is_value_specialisation_of (unary_type_trait shortcut).
Definition template_inspection.hpp:179
transformation_trait_or.hpp
Provides seqan3::detail::transformation_trait_or.
Hide me