Skip to content

Commit d645b4e

Browse files
committed
Define virtual destructor for IndexScorer
It must be defined in order for any `std::unique_ptr<IndexScorer>` to execute the correct deleter when it goes out of scope. Because we define the constructor, we also define the copy/move constructor/operator, and in turn also default constructor, which we need. Signed-off-by: Michal Siedlaczek <[email protected]>
1 parent 3d1f70e commit d645b4e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

include/pisa/scorer/index_scorer.hpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,18 @@ using TermScorer = std::function<float(uint32_t, uint32_t)>;
1010
/** Index scorer construct scorers for terms in the index. */
1111
class IndexScorer {
1212
public:
13+
IndexScorer() = default;
14+
IndexScorer(const IndexScorer&) = default;
15+
IndexScorer(IndexScorer&&) noexcept = default;
16+
IndexScorer& operator=(const IndexScorer&) = delete;
17+
IndexScorer& operator=(IndexScorer&&) noexcept = delete;
18+
virtual ~IndexScorer() = default;
1319
virtual TermScorer term_scorer(std::uint64_t term_id) const = 0;
1420
};
1521

1622
/** Index scorer using WAND metadata for scoring. */
1723
template <typename Wand>
18-
struct WandIndexScorer: IndexScorer {
24+
struct WandIndexScorer: public IndexScorer {
1925
protected:
2026
const Wand& m_wdata;
2127

0 commit comments

Comments
 (0)