Loading...
Searching...
No Matches
function_traits.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 <functional>
#include <seqan3/utility/type_pack/traits.hpp>
namespace seqan3
{
template <typename function_t>
struct function_traits;
template <typename return_t, typename... args_t>
struct function_traits<std::function<return_t(args_t...)>>
{
static constexpr size_t argument_count = sizeof...(args_t);
using result_type = return_t;
template <size_t index>
requires (index < argument_count)
using argument_type_at = pack_traits::at<index, args_t...>;
};
// Overload for all function types.
template <typename function_t>
requires requires (function_t fn) {
{ std::function{fn} };
}
struct function_traits<function_t> : function_traits<decltype(std::function{std::declval<function_t>()})>
{};
} // namespace seqan3
std::function
functional
seqan3::pack_traits::at
typename decltype(detail::at< idx, pack_t... >())::type at
Return the type at given index from the type pack.
Definition type_pack/traits.hpp:245
seqan3
The main SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
std
SeqAn specific customisations in the standard namespace.
seqan3::function_traits< std::function< return_t(args_t...)> >::argument_count
static constexpr size_t argument_count
The number of arguments passed to the std::function target.
Definition function_traits.hpp:45
seqan3::function_traits< std::function< return_t(args_t...)> >::result_type
return_t result_type
The return type of the function target.
Definition function_traits.hpp:48
seqan3::function_traits< std::function< return_t(args_t...)> >::argument_type_at
pack_traits::at< index, args_t... > argument_type_at
The argument type at the given index.
Definition function_traits.hpp:55
traits.hpp
Provides various traits for template packs.
Hide me