We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 16ee7a0 commit 896ba22Copy full SHA for 896ba22
CHANGELOG.md
@@ -1,3 +1,7 @@
1
+## 0.2.1 (unreleased)
2
+
3
+- Added `std::span` constructor to `Vector`
4
5
## 0.2.0 (2024-07-10)
6
7
- Added support for `halfvec` and `sparsevec` types
include/vector.hpp
@@ -9,6 +9,10 @@
9
#include <ostream>
10
#include <vector>
11
12
+#if __cplusplus >= 202002L
13
+#include <span>
14
+#endif
15
16
namespace pgvector {
17
class Vector {
18
public:
@@ -26,6 +30,12 @@ class Vector {
26
30
value_ = std::vector<float>{value, value + n};
27
31
}
28
32
33
34
+ Vector(std::span<const float> value) {
35
+ value_ = std::vector<float>(value.begin(), value.end());
36
+ }
37
38
29
39
size_t dimensions() const {
40
return value_.size();
41
0 commit comments