SeqAn3  3.0.3
The Modern C++ library for sequence analysis.
istreambuf.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 
15 #include <iosfwd>
16 
17 #include <seqan3/std/iterator>
18 #include <seqan3/std/ranges>
19 
22 
23 namespace seqan3::detail
24 {
25 
26 // ============================================================================
27 // istreambuf_fn (adaptor definition)
28 // ============================================================================
29 
32 {
39  template <typename stream_char_t, typename stream_traits_t>
41  {
42  return std::ranges::subrange<detail::fast_istreambuf_iterator<stream_char_t, stream_traits_t>,
43  std::default_sentinel_t>
44  {
46  std::default_sentinel_t{}
47  };
48  }
49 
55  template <input_stream stream_t>
56  constexpr auto operator()(stream_t & s) const
57  {
58  return this->operator()(*s.rdbuf());
59  }
60 };
61 
62 } // namespace seqan3::detail
63 
64 // ============================================================================
65 // views::istreambuf (adaptor instance definition)
66 // ============================================================================
67 
68 namespace seqan3::views
69 {
70 
114 inline constexpr auto istreambuf = detail::istreambuf_fn{};
116 
117 } // namespace seqan3::views
Functionally the same as std::istreambuf_iterator, but faster.
Definition: fast_istreambuf_iterator.hpp:37
Provides seqan3::detail::fast_istreambuf_iterator.
constexpr auto istreambuf
A view factory that returns a view over the stream buffer of an input stream.
Definition: istreambuf.hpp:114
Stream concepts.
Provides C++20 additions to the <iterator> header.
The internal SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
The SeqAn namespace for views.
Adaptations of concepts from the Ranges TS.
View adaptor/factory definition for views::istream.
Definition: istreambuf.hpp:32
constexpr auto operator()(std::basic_streambuf< stream_char_t, stream_traits_t > &s) const
Return the view object.
Definition: istreambuf.hpp:40
constexpr auto operator()(stream_t &s) const
Return the view object.
Definition: istreambuf.hpp:56