cql3: make prepare_context::get_variable_specifications() return const-ref for lvalue overload

There's no point in copying the `_specs` vector by value in such
case, just return a const reference. All existing uses create
a copy either way.

Tests: unit(dev)

Signed-off-by: Pavel Solodovnikov <pa.solodovnikov@scylladb.com>
This commit is contained in:
Pavel Solodovnikov
2021-07-28 23:31:32 +03:00
parent 1c7af8d46f
commit 0edf975bf7
2 changed files with 3 additions and 3 deletions

View File

@@ -58,8 +58,8 @@ size_t prepare_context::bound_variables_size() const {
return _variable_names.size();
}
std::vector<lw_shared_ptr<column_specification>> prepare_context::get_variable_specifications() const & {
return std::vector<lw_shared_ptr<column_specification>>(_specs.begin(), _specs.end());
const std::vector<lw_shared_ptr<column_specification>>& prepare_context::get_variable_specifications() const & {
return _specs;
}
std::vector<lw_shared_ptr<column_specification>> prepare_context::get_variable_specifications() && {

View File

@@ -86,7 +86,7 @@ public:
size_t bound_variables_size() const;
std::vector<lw_shared_ptr<column_specification>> get_variable_specifications() const &;
const std::vector<lw_shared_ptr<column_specification>>& get_variable_specifications() const &;
std::vector<lw_shared_ptr<column_specification>> get_variable_specifications() &&;