SeqAn3  3.2.0
The Modern C++ library for sequence analysis.
tuple.hpp
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------------------------------
2 // Copyright (c) 2006-2022, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2022, 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 <concepts>
16 #include <ranges>
17 
21 
22 namespace seqan3
23 {
27 } // namespace seqan3
28 
29 namespace seqan3::detail
30 {
31 
33 template <typename char_t, typename tuple_t, std::size_t... I>
34 void print_tuple(debug_stream_type<char_t> & s, tuple_t && t, std::index_sequence<I...> const &)
35 {
36  using std::get;
37  s << '(';
38  ((s << (I == 0 ? "" : ",") << get<I>(t)), ...);
39  s << ')';
40 }
41 
53 template <typename tuple_t>
54 concept debug_streamable_tuple = !
55 std::ranges::input_range<tuple_t> && !alphabet<tuple_t> && // exclude alphabet_tuple_base
58 } // namespace seqan3::detail
59 
60 namespace seqan3
61 {
62 
69 template <typename char_t, typename tuple_t>
70  requires (detail::debug_streamable_tuple<tuple_t>)
72 {
73  detail::print_tuple(s,
74  std::forward<tuple_t>(t),
75  std::make_index_sequence<std::tuple_size_v<std::remove_cvref_t<tuple_t>>>{});
76  return s;
77 }
78 
80 
81 } // namespace seqan3
Core alphabet concept and free function/type trait wrappers.
A "pretty printer" for most SeqAn data structures and related types.
Definition: debug_stream_type.hpp:78
requires(detail::debug_streamable_tuple< tuple_t >) inline debug_stream_type< char_t > &operator<<(debug_stream_type< char_t > &s
All tuples can be printed by printing their elements separately.
The <concepts> header from C++20's standard library.
Provides seqan3::debug_stream and related types.
The generic alphabet concept that covers most data types used in ranges.
Whether a type behaves like a tuple.
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
requires detail::debug_stream_range_guard< alignment_matrix_t > &&detail::matrix< alignment_matrix_t > debug_stream_type< char_t > & operator<<(debug_stream_type< char_t > &s, alignment_matrix_t &&matrix)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: debug_matrix.hpp:496
constexpr auto const & get(configuration< configs_t... > const &config) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: configuration.hpp:415
The <ranges> header from C++20's standard library.
T tuple_size_v
Provides seqan3::tuple_like.