Skip to content

Commit e3180ef

Browse files
committed
bugfix: Make AggregationType::Value constructor explicit
1 parent 5c7fc3c commit e3180ef

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

tools/queries.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
#include "topk_queue.hpp"
5151
#include "type_alias.hpp"
5252
#include "util/do_not_optimize_away.hpp"
53-
#include "util/util.hpp"
5453
#include "wand_data.hpp"
5554
#include "wand_data_compressed.hpp"
5655
#include "wand_data_raw.hpp"
@@ -63,7 +62,7 @@ class AggregationType {
6362
enum Value { None = 0, Min = 1, Mean = 2, Median = 3, Max = 4 };
6463

6564
explicit constexpr AggregationType(Value value) : m_value(value) {}
66-
constexpr operator Value() const { return m_value; }
65+
constexpr explicit operator Value() const { return m_value; }
6766

6867
[[nodiscard]] auto to_string() const -> std::string {
6968
switch (m_value) {
@@ -157,12 +156,12 @@ struct QueryTimes {
157156
}
158157

159158
auto aggregate(AggregationType aggregation_type) const -> std::vector<std::size_t> {
160-
switch (aggregation_type) {
161-
case AggregationType::None: return aggregate_none();
162-
case AggregationType::Min: return aggregate_min();
163-
case AggregationType::Mean: return aggregate_mean();
164-
case AggregationType::Median: return aggregate_median();
165-
case AggregationType::Max: return aggregate_max();
159+
switch (AggregationType::Value(aggregation_type)) {
160+
case AggregationType::Value::None: return aggregate_none();
161+
case AggregationType::Value::Min: return aggregate_min();
162+
case AggregationType::Value::Mean: return aggregate_mean();
163+
case AggregationType::Value::Median: return aggregate_median();
164+
case AggregationType::Value::Max: return aggregate_max();
166165
}
167166
throw std::logic_error("Unknown AggregationType");
168167
}

0 commit comments

Comments
 (0)