SeqAn3 3.2.0
The Modern C++ library for sequence analysis.
istreambuf_view.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 <iosfwd>
16#include <iterator>
17#include <ranges>
18
21
22namespace seqan3::detail
23{
24
25// ============================================================================
26// istreambuf_fn (adaptor definition)
27// ============================================================================
28
31struct 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 detail::fast_istreambuf_iterator<stream_char_t, stream_traits_t>{s},
45 std::default_sentinel_t{}};
46 }
47
53 template <input_stream stream_t>
54 constexpr auto operator()(stream_t & s) const
55 {
56 return this->operator()(*s.rdbuf());
57 }
58};
59
60} // namespace seqan3::detail
61
62// ============================================================================
63// detail::istreambuf (adaptor instance definition)
64// ============================================================================
65
66namespace seqan3::detail
67{
107inline constexpr auto istreambuf = detail::istreambuf_fn{};
108
109} // namespace seqan3::detail
Provides seqan3::detail::fast_istreambuf_iterator.
Stream concepts.