| 500 | template<> void VariableImpl<std::string>::SetString(std::string const& value, SetBy setby) { SetData(value, setby); } |
| 501 | |
| 502 | template <typename T> std::string vector_to_string(T v) |
| 503 | { |
| 504 | std::string result; |
| 505 | for (int i = 0; i < T::DIM; ++i) |
| 506 | { |
| 507 | char buff[16] = { 0 }; |
| 508 | if (auto [p, ec] = std::to_chars(buff, buff + 16, v[i]); ec == std::errc()) |
| 509 | { |
| 510 | if (i < (T::DIM - 1)) |
| 511 | *p = ' '; |
| 512 | |
| 513 | result += buff; |
| 514 | } |
| 515 | } |
| 516 | return result; |
| 517 | } |
| 518 | |
| 519 | // A specialization of vector_to_string to work around std::to_chars being unavailable for float on clang |
| 520 | template <int N> std::string float_vector_to_string(dm::vector<float, N> v) |