@@ -31,12 +31,14 @@ template <> struct string_traits<pgvector::Vector> {
3131 throw conversion_error (" Malformed vector literal" );
3232 }
3333
34- // TODO don't copy string
3534 std::vector<float > result;
35+ // TODO support empty array
36+ // TODO don't copy string
3637 std::istringstream ss (std::string (text.substr (1 , text.size () - 2 )));
3738 while (ss.good ()) {
3839 std::string substr;
3940 std::getline (ss, substr, ' ,' );
41+ // TODO use pqxx::from_string<float>
4042 result.push_back (std::stof (substr));
4143 }
4244 return pgvector::Vector (result);
@@ -66,12 +68,14 @@ template <> struct string_traits<pgvector::HalfVector> {
6668 throw conversion_error (" Malformed halfvec literal" );
6769 }
6870
69- // TODO don't copy string
7071 std::vector<float > result;
72+ // TODO support empty array
73+ // TODO don't copy string
7174 std::istringstream ss (std::string (text.substr (1 , text.size () - 2 )));
7275 while (ss.good ()) {
7376 std::string substr;
7477 std::getline (ss, substr, ' ,' );
78+ // TODO use pqxx::from_string<float>
7579 result.push_back (std::stof (substr));
7680 }
7781 return pgvector::HalfVector (result);
0 commit comments