SeqAn3  3.0.1
The Modern C++ library for sequence analysis.
debug_stream_tuple.hpp
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------------------------------
2 // Copyright (c) 2006-2020, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2020, 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 
18 #include <seqan3/std/ranges>
19 
20 namespace seqan3
21 {
25 } // namespace seqan3
26 
27 namespace seqan3::detail
28 {
29 
31 template <typename char_t, typename tuple_t, std::size_t ...I>
32 void print_tuple(debug_stream_type<char_t> & s, tuple_t && t, std::index_sequence<I...> const &)
33 {
34  using std::get;
35  s << '(';
36  ((s << (I == 0 ? "" : ",") << get<I>(t)), ...);
37  s << ')';
38 }
39 
40 } // namespace seqan3::detail
41 
42 namespace seqan3
43 {
44 
51 template <typename tuple_t, typename char_t>
53  requires !std::ranges::input_range<tuple_t> &&
54  !alphabet<tuple_t> && // exclude alphabet_tuple_base
55  tuple_like<remove_cvref_t<tuple_t>>
57 inline debug_stream_type<char_t> & operator<<(debug_stream_type<char_t> & s, tuple_t && t)
58 {
59  detail::print_tuple(s, std::forward<tuple_t>(t),
61  return s;
62 }
63 
65 
66 } // namespace seqan3
Provides seqan3::debug_stream and related types.
The main SeqAn3 namespace.
Provides seqan3::tuple_like.
auto const get
A view calling std::get on each element in a range.
Definition: get.hpp:65
Adaptations of concepts from the Ranges TS.
T tuple_size_v
Definition: aligned_sequence_concept.hpp:36
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:70