SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
repeat_n.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin
2// SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
3// SPDX-License-Identifier: BSD-3-Clause
4
10#pragma once
11
12#include <concepts>
13
16
17namespace seqan3::detail
18{
19
25struct repeat_n_fn
26{
33 template <typename value_t>
34 constexpr auto operator()(value_t && value, size_t const count) const
35 {
36 static_assert(std::copy_constructible<value_t>, "The value passed to repeat_n must be copy constructible.");
37
38 return views::repeat(std::forward<value_t>(value)) | detail::take_exactly(count);
39 }
40};
41
42} // namespace seqan3::detail
43
44namespace seqan3::views
45{
88inline constexpr auto repeat_n = detail::repeat_n_fn{};
89
90} // namespace seqan3::views
constexpr detail::repeat_fn repeat
A view factory that repeats a given value infinitely.
Definition repeat.hpp:344
constexpr auto repeat_n
A view factory that repeats a given value n times.
Definition repeat_n.hpp:88
The SeqAn namespace for views.
Definition char_strictly_to.hpp:19
Provides the seqan3::views::repeat.
Provides seqan3::views::take_exactly and seqan3::views::take_exactly_or_throw.
Hide me