diff --git a/cql3/expr/expression.cc b/cql3/expr/expression.cc index 43b522f7d2..6d7d0064ce 100644 --- a/cql3/expr/expression.cc +++ b/cql3/expr/expression.cc @@ -673,25 +673,28 @@ std::vector first_multicolumn_bound( } template -nonwrapping_range to_range(oper_t op, const T& val) { +nonwrapping_range> to_range(oper_t op, T&& val) { + using U = std::remove_cvref_t; static constexpr bool inclusive = true, exclusive = false; switch (op) { case oper_t::EQ: - return nonwrapping_range::make_singular(val); + return nonwrapping_range::make_singular(std::forward(val)); case oper_t::GT: - return nonwrapping_range::make_starting_with(interval_bound(val, exclusive)); + return nonwrapping_range::make_starting_with(interval_bound(std::forward(val), exclusive)); case oper_t::GTE: - return nonwrapping_range::make_starting_with(interval_bound(val, inclusive)); + return nonwrapping_range::make_starting_with(interval_bound(std::forward(val), inclusive)); case oper_t::LT: - return nonwrapping_range::make_ending_with(interval_bound(val, exclusive)); + return nonwrapping_range::make_ending_with(interval_bound(std::forward(val), exclusive)); case oper_t::LTE: - return nonwrapping_range::make_ending_with(interval_bound(val, inclusive)); + return nonwrapping_range::make_ending_with(interval_bound(std::forward(val), inclusive)); default: throw std::logic_error(format("to_range: unknown comparison operator {}", op)); } } -template nonwrapping_range to_range(oper_t, const clustering_key_prefix&); +nonwrapping_range to_range(oper_t op, const clustering_key_prefix& val) { + return to_range(op, val); +} value_set possible_lhs_values(const column_definition* cdef, const expression& expr, const query_options& options) { const auto type = cdef ? get_value_comparator(cdef) : long_type.get(); diff --git a/cql3/expr/expression.hh b/cql3/expr/expression.hh index 8d41f3fb5b..b7a13ea121 100644 --- a/cql3/expr/expression.hh +++ b/cql3/expr/expression.hh @@ -139,8 +139,7 @@ extern value_set possible_lhs_values(const column_definition*, const expression& extern nonwrapping_range to_range(const value_set&); /// A range of all X such that X op val. -template -nonwrapping_range to_range(oper_t op, const T& val); +nonwrapping_range to_range(oper_t op, const clustering_key_prefix& val); /// True iff the index can support the entire expression. extern bool is_supported_by(const expression&, const secondary_index::index&);