#pragma once #include #include #include #include namespace extra_arx_parsers { template requires (Count > 0) [[nodiscard]] inline std::optional> glm_vec(const std::string_view& str) { glm::vec vec{}; auto it = str.cbegin(); for (int i = 0; i < Count; i++) { const auto [ptr, ec] = std::from_chars(it, str.cend(), vec[i], std::chars_format::general); if (ec != std::errc()) { return std::nullopt; } it = ptr + 1; // skip space in between components } if (it < str.cend()) { return std::nullopt; } return vec; } }