SeqAn3  3.0.2
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 
19 #include <seqan3/std/iterator>
20 #include <seqan3/std/ranges>
21 
22 namespace seqan3::detail
23 {
24 
25 // ============================================================================
26 // istreambuf_fn (adaptor definition)
27 // ============================================================================
28 
30 struct istreambuf_fn
31 {
38  template <typename stream_char_t, typename stream_traits_t>
39  constexpr auto operator()(std::basic_streambuf<stream_char_t, stream_traits_t> & s) const
40  {
41  return std::ranges::subrange<detail::fast_istreambuf_iterator<stream_char_t, stream_traits_t>,
42  std::default_sentinel_t>
43  {
44  detail::fast_istreambuf_iterator<stream_char_t, stream_traits_t>{s},
45  std::default_sentinel_t{}
46  };
47  }
48 
54  template <input_stream stream_t>
55  constexpr auto operator()(stream_t & s) const
56  {
57  return this->operator()(*s.rdbuf());
58  }
59 };
60 
61 } // namespace seqan3::detail
62 
63 // ============================================================================
64 // views::istreambuf (adaptor instance definition)
65 // ============================================================================
66 
67 namespace seqan3::views
68 {
69 
113 inline constexpr auto istreambuf = detail::istreambuf_fn{};
115 
116 } // namespace seqan3::views
seqan3::views
The SeqAn namespace for views.
Definition: view_iota_simd.hpp:218
concept.hpp
Stream concepts.
iosfwd
iterator
Provides C++20 additions to the <iterator> header.
std::basic_streambuf
ranges
Adaptations of concepts from the Ranges TS.
iterator.hpp
Provides seqan3::fast_istreambuf_iterator and seqan3::fast_ostreambuf_iterator, as well as,...
seqan3::views::istreambuf
constexpr auto istreambuf
A view factory that returns a view over the stream buffer of an input stream.
Definition: istreambuf.hpp:113