SeqAn3  3.0.3
The Modern C++ library for sequence analysis.
istreambuf_view.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 <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 
31 struct istreambuf_fn
32 {
39  template <typename stream_char_t, typename stream_traits_t>
40  constexpr auto operator()(std::basic_streambuf<stream_char_t, stream_traits_t> & s) const
41  {
42  return std::ranges::subrange<detail::fast_istreambuf_iterator<stream_char_t, stream_traits_t>,
43  std::default_sentinel_t>
44  {
45  detail::fast_istreambuf_iterator<stream_char_t, stream_traits_t>{s},
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 // detail::istreambuf (adaptor instance definition)
66 // ============================================================================
67 
68 namespace seqan3::detail
69 {
70 
76 inline constexpr auto istreambuf = detail::istreambuf_fn{};
78 
79 } // namespace seqan3::detail
80 
81 #ifdef SEQAN3_DEPRECATED_310
82 namespace seqan3::views
83 {
127 } // namespace seqan3::views
128 #endif // SEQAN3_DEPRECATED_310
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_view.hpp:126
Stream concepts.
Provides C++20 additions to the <iterator> header.
The SeqAn namespace for views.
Definition: char_to.hpp:22
#define SEQAN3_DEPRECATED_310
Deprecation message for SeqAn 3.1.0 release.
Definition: platform.hpp:203
Adaptations of concepts from the Ranges TS.