Skip to content

Commit 9dacbdf

Browse files
committed
Simplified code [skip ci]
1 parent 9989174 commit 9dacbdf

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
@@ -45,7 +45,7 @@ template <> struct string_traits<pgvector::Vector> {
4545
}
4646

4747
static std::string_view to_buf(std::span<char> buf, const pgvector::Vector& value, ctx c = {}) {
48-
auto values = static_cast<std::span<const float>>(value);
48+
std::span<const float> values{value};
4949

5050
// important! size_buffer cannot throw an exception on overflow
5151
// so perform this check before writing any data
@@ -69,7 +69,7 @@ template <> struct string_traits<pgvector::Vector> {
6969
}
7070

7171
static size_t size_buffer(const pgvector::Vector& value) noexcept {
72-
auto values = static_cast<std::span<const float>>(value);
72+
std::span<const float> values{value};
7373

7474
// cannot throw an exception here on overflow
7575
// so throw in into_buf
@@ -109,7 +109,7 @@ template <> struct string_traits<pgvector::HalfVector> {
109109
}
110110

111111
static std::string_view to_buf(std::span<char> buf, const pgvector::HalfVector& value, ctx c = {}) {
112-
auto values = static_cast<std::span<const float>>(value);
112+
std::span<const float> values{value};
113113

114114
// important! size_buffer cannot throw an exception on overflow
115115
// so perform this check before writing any data
@@ -133,7 +133,7 @@ template <> struct string_traits<pgvector::HalfVector> {
133133
}
134134

135135
static size_t size_buffer(const pgvector::HalfVector& value) noexcept {
136-
auto values = static_cast<std::span<const float>>(value);
136+
std::span<const float> values{value};
137137

138138
// cannot throw an exception here on overflow
139139
// so throw in into_buf

0 commit comments

Comments
 (0)