Skip to content

Commit 8344aef

Browse files
committed
Improved code [skip ci]
1 parent 171948c commit 8344aef

2 files changed

Lines changed: 4 additions & 12 deletions

File tree

include/pgvector/halfvec.hpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,10 @@ class HalfVector {
2020
explicit HalfVector(const std::vector<float>& value) : value_{value} {}
2121

2222
/// Creates a half vector from a `std::vector<float>`.
23-
explicit HalfVector(std::vector<float>&& value) {
24-
value_ = std::move(value);
25-
}
23+
explicit HalfVector(std::vector<float>&& value) : value_{std::move(value)} {}
2624

2725
/// Creates a half vector from a span.
28-
explicit HalfVector(std::span<const float> value) {
29-
value_ = std::vector<float>(value.begin(), value.end());
30-
}
26+
explicit HalfVector(std::span<const float> value) : value_{std::vector<float>(value.begin(), value.end())} {}
3127

3228
/// Returns the number of dimensions.
3329
size_t dimensions() const {

include/pgvector/vector.hpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,10 @@ class Vector {
2020
explicit Vector(const std::vector<float>& value) : value_{value} {}
2121

2222
/// Creates a vector from a `std::vector<float>`.
23-
explicit Vector(std::vector<float>&& value) {
24-
value_ = std::move(value);
25-
}
23+
explicit Vector(std::vector<float>&& value) : value_{std::move(value)} {}
2624

2725
/// Creates a vector from a span.
28-
explicit Vector(std::span<const float> value) {
29-
value_ = std::vector<float>(value.begin(), value.end());
30-
}
26+
explicit Vector(std::span<const float> value) : value_{std::vector<float>(value.begin(), value.end())} {}
3127

3228
/// Returns the number of dimensions.
3329
size_t dimensions() const {

0 commit comments

Comments
 (0)