Raptor
A fast and space-efficient pre-filter
All Classes Namespaces Files Functions Variables Macros Pages Concepts
emplace_iterator.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 <hibf/interleaved_bloom_filter.hpp>
13
14namespace raptor
15{
16
18{
19public:
21 using value_type = void;
22 using difference_type = ptrdiff_t;
23 using pointer = void;
24 using reference = void;
25
26 emplace_iterator() = delete;
27 emplace_iterator(emplace_iterator const &) = default;
29 emplace_iterator & operator=(emplace_iterator const &) = default;
30 emplace_iterator & operator=(emplace_iterator &&) = default;
31 ~emplace_iterator() = default;
32
33 explicit constexpr emplace_iterator(seqan::hibf::interleaved_bloom_filter & ibf, seqan::hibf::bin_index const idx) :
34 ibf{std::addressof(ibf)},
35 index{idx}
36 {}
37
38 /* constexpr */ emplace_iterator & operator=(uint64_t const value) noexcept
39 {
40 assert(ibf != nullptr);
41 ibf->emplace(value, index);
42 return *this;
43 }
44
45 [[nodiscard]] constexpr emplace_iterator & operator*() noexcept
46 {
47 return *this;
48 }
49
50 constexpr emplace_iterator & operator++() noexcept
51 {
52 return *this;
53 }
54
55 constexpr emplace_iterator operator++(int) noexcept
56 {
57 return *this;
58 }
59
60private:
61 seqan::hibf::interleaved_bloom_filter * ibf{nullptr};
62 seqan::hibf::bin_index index{};
63};
64
65[[nodiscard]] inline constexpr emplace_iterator emplacer(seqan::hibf::interleaved_bloom_filter & ibf,
66 seqan::hibf::bin_index const idx)
67{
68 return emplace_iterator{ibf, idx};
69}
70
71} // namespace raptor
T addressof(T... args)
Definition emplace_iterator.hpp:18
Hide me