blob: 8f350f34c35bbdbfe71e39ff40fd234937678396 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
namespace search::attribute {
/*
* Class used to traverse a posting list and call the functor for each
* lid.
*/
template <typename PostingList>
class PostingListTraverser
{
using EntryRef = vespalib::datastore::EntryRef;
const PostingList &_postingList;
EntryRef _pidx;
public:
PostingListTraverser(const PostingList &postingList, EntryRef pidx)
: _postingList(postingList),
_pidx(pidx)
{
}
~PostingListTraverser() { }
template <typename Func>
void
foreach(Func func) const {
_postingList.foreach_frozen(_pidx, func);
}
template <typename Func>
void
foreach_key(Func func) const {
_postingList.foreach_frozen_key(_pidx, func);
}
};
}
|