SeqAn3 3.1.0
The Modern C++ library for sequence analysis.
function_traits.hpp
Go to the documentation of this file.
1// -----------------------------------------------------------------------------------------------------
2// Copyright (c) 2006-2021, Knut Reinert & Freie Universität Berlin
3// Copyright (c) 2016-2021, 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 <functional>
16
18
19namespace seqan3
20{
21
23template <typename function_t>
24struct function_traits;
26
44template <typename return_t, typename ...args_t>
45struct function_traits<std::function<return_t(args_t...)>>
46{
48 static constexpr size_t argument_count = sizeof...(args_t);
49
51 using result_type = return_t;
52
56 template <size_t index>
58 requires (index < argument_count)
61};
62
64// Overload for all function types.
65template <typename function_t>
66 requires requires (function_t fn) { {std::function{fn}}; }
67struct function_traits<function_t> : function_traits<decltype(std::function{std::declval<function_t>()})>
68{};
70
71} // namespace seqan3
typename decltype(detail::at< idx, pack_t... >())::type at
Return the type at given index from the type pack.
Definition: traits.hpp:256
The main SeqAn3 namespace.
Definition: cigar_operation_table.hpp:2
SeqAn specific customisations in the standard namespace.
return_t result_type
The return type of the function target.
Definition: function_traits.hpp:51
pack_traits::at< index, args_t... > argument_type_at
The argument type at the given index.
Definition: function_traits.hpp:60
Provides various traits for template packs.