@@ -13,22 +13,22 @@ std::string coerce(std::string_view version) { return ""; }
1313std::string minimum (std::string_view range) { return " " ; }
1414std::string clean (std::string_view range) { return " " ; }
1515
16- inline std::string_view trim_whitespace (std::string_view input) noexcept {
17- while (!input. empty () && std::isspace (input. front ())) {
18- input. remove_prefix (1 );
16+ inline void trim_whitespace (std::string_view* input) noexcept {
17+ while (!input-> empty () && std::isspace (input-> front ())) {
18+ input-> remove_prefix (1 );
1919 }
20- while (!input. empty () && std::isspace (input. back ())) {
21- input. remove_suffix (1 );
20+ while (!input-> empty () && std::isspace (input-> back ())) {
21+ input-> remove_suffix (1 );
2222 }
23- return input;
2423}
2524
2625std::expected<Version, ParseError> parse (std::string_view input) {
2726 if (input.size () > MAX_VERSION_LENGTH) {
2827 return std::unexpected (ParseError::VERSION_LARGER_THAN_MAX_LENGTH);
2928 }
3029
31- std::string_view input_copy = trim_whitespace (input);
30+ std::string_view input_copy = input;
31+ trim_whitespace (&input_copy);
3232
3333 auto dot_iterator = input_copy.find (' .' );
3434 if (dot_iterator == std::string_view::npos) {
@@ -90,4 +90,5 @@ std::expected<Version, ParseError> parse(std::string_view input) {
9090 version.build = input_copy;
9191 return version;
9292}
93+
9394} // namespace version_weaver
0 commit comments