@@ -35,12 +35,14 @@ template <> struct string_traits<pgvector::Vector> {
3535 throw conversion_error (" Malformed vector literal" );
3636 }
3737
38- // TODO don't copy string
3938 std::vector<float > result;
39+ // TODO support empty array
40+ // TODO don't copy string
4041 std::istringstream ss (std::string (text.substr (1 , text.size () - 2 )));
4142 while (ss.good ()) {
4243 std::string substr;
4344 std::getline (ss, substr, ' ,' );
45+ // TODO use pqxx::from_string<float>
4446 result.push_back (std::stof (substr));
4547 }
4648 return pgvector::Vector (result);
@@ -80,12 +82,14 @@ template <> struct string_traits<pgvector::HalfVector> {
8082 throw conversion_error (" Malformed halfvec literal" );
8183 }
8284
83- // TODO don't copy string
8485 std::vector<float > result;
86+ // TODO support empty array
87+ // TODO don't copy string
8588 std::istringstream ss (std::string (text.substr (1 , text.size () - 2 )));
8689 while (ss.good ()) {
8790 std::string substr;
8891 std::getline (ss, substr, ' ,' );
92+ // TODO use pqxx::from_string<float>
8993 result.push_back (std::stof (substr));
9094 }
9195 return pgvector::HalfVector (result);
0 commit comments