Loading...
Searching...
No Matches
out_file_iterator.hpp
Go to the documentation of this file.
// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: BSD-3-Clause
#pragma once
#include <cassert>
#include <ranges>
#include <seqan3/core/platform.hpp>
namespace seqan3::detail
{
template <typename file_type>
class out_file_iterator
{
static_assert(!std::is_const_v<file_type>,
"You cannot iterate over const files, because the iterator changes the file.");
public:
using value_type = void;
using reference = void;
using const_reference = void;
using size_type = void;
using difference_type = std::ptrdiff_t;
using pointer = void *;
using iterator_category = std::output_iterator_tag;
constexpr out_file_iterator() = default;
constexpr out_file_iterator(out_file_iterator const &) = default;
constexpr out_file_iterator & operator=(out_file_iterator const &) = default;
constexpr out_file_iterator(out_file_iterator &&) = default;
constexpr out_file_iterator & operator=(out_file_iterator &&) = default;
~out_file_iterator() = default;
constexpr out_file_iterator(file_type & _host) noexcept : host{&_host}
{}
out_file_iterator & operator++()
{
return *this;
}
out_file_iterator operator++(int)
{
return *this;
}
out_file_iterator & operator*() noexcept
{
return *this;
}
template <typename arg_t>
out_file_iterator & operator=(arg_t && arg)
{
assert(host != nullptr);
host->push_back(std::forward<arg_t>(arg));
return *this;
}
constexpr bool operator==(std::default_sentinel_t const &) const noexcept
{
return false;
}
constexpr bool operator!=(std::default_sentinel_t const &) const noexcept
{
return true;
}
constexpr friend bool operator==(std::default_sentinel_t const &, out_file_iterator const & it) noexcept
{
return (it == std::default_sentinel);
}
constexpr friend bool operator!=(std::default_sentinel_t const &, out_file_iterator const & it) noexcept
{
return (it != std::default_sentinel);
}
private:
file_type * host{};
};
} // namespace seqan3::detail
cassert
std::forward
T forward(T... args)
std::is_const_v
T is_const_v
platform.hpp
Provides platform and dependency checks.
Hide me