@@ -47,8 +47,8 @@ enum class token_policy {
4747// @see https://urlpattern.spec.whatwg.org/#tokens
4848class token {
4949 public:
50- token (token_type _type, size_t _index, std::string&& _value)
51- : type(_type), index(_index), value(std::move( _value) ) {}
50+ token (token_type _type, size_t _index, std::string_view _value)
51+ : type(_type), index(_index), value(_value) {}
5252
5353 // A token has an associated type, a string, initially "invalid-char".
5454 token_type type = token_type::INVALID_CHAR;
@@ -59,7 +59,7 @@ class token {
5959
6060 // A token has an associated value, a string, initially the empty string. It
6161 // contains the code points from the pattern string represented by the token.
62- std::string value{};
62+ std::string_view value{};
6363};
6464
6565// @see https://urlpattern.spec.whatwg.org/#pattern-parser
@@ -137,7 +137,7 @@ class Tokenizer {
137137
138138 private:
139139 // has an associated input, a pattern string, initially the empty string.
140- std::string input;
140+ std::string_view input;
141141 // has an associated policy, a tokenize policy, initially "strict".
142142 token_policy policy;
143143 // has an associated token list, a token list, initially an empty list.
@@ -231,7 +231,7 @@ struct constructor_string_parser {
231231 // @see https://urlpattern.spec.whatwg.org/#make-a-component-string
232232 std::string make_component_string ();
233233 // has an associated input, a string, which must be set upon creation.
234- std::string input;
234+ std::string_view input;
235235 // has an associated token list, a token list, which must be set upon
236236 // creation.
237237 std::vector<token> token_list;
0 commit comments