Skip to content

Commit 37d8db2

Browse files
committed
Removed unnecessary copying
1 parent 7dcba75 commit 37d8db2

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

include/pgvector/pqxx.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@ template <> struct string_traits<pgvector::SparseVector> {
206206

207207
static std::string_view to_buf(std::span<char> buf, const pgvector::SparseVector& value, ctx c = {}) {
208208
int dimensions = value.dimensions();
209-
auto indices = value.indices();
210-
auto values = value.values();
209+
auto& indices = value.indices();
210+
auto& values = value.values();
211211
size_t nnz = indices.size();
212212

213213
// important! size_buffer cannot throw an exception on overflow
@@ -237,8 +237,8 @@ template <> struct string_traits<pgvector::SparseVector> {
237237

238238
static size_t size_buffer(const pgvector::SparseVector& value) noexcept {
239239
int dimensions = value.dimensions();
240-
auto indices = value.indices();
241-
auto values = value.values();
240+
auto& indices = value.indices();
241+
auto& values = value.values();
242242
size_t nnz = indices.size();
243243

244244
// cannot throw an exception here on overflow

0 commit comments

Comments
 (0)