:relfileprefix: ../../../ [#02625EEC2B6C30C666A21DF49B2B48C862B021EF] = Function url::url pass:v,q[Constructor] == Synopsis Declared in header `` [source,cpp,subs="verbatim,macros,-callouts"] ---- url(string_view s); ---- == Description pass:v,q[This function constructs a URL from] pass:v,q[the string `s`, which must contain a] pass:v,q[valid] pass:v,q[URI] pass:v,q[or] pass:v,q[relative-ref] pass:v,q[or else an exception is thrown.] pass:v,q[The new url retains ownership by] pass:v,q[allocating a copy of the passed string.] === Example [,cpp] ---- url u( "https://www.example.com" ); ---- === Effects [,cpp] ---- return url( parse_uri_reference( s ).value() ); ---- === Postconditions [,cpp] ---- this->buffer().data() != s.data() ---- === Complexity pass:v,q[Linear in `s.size()`.] === Exception Safety pass:v,q[Calls to allocate may throw.] pass:v,q[Exceptions thrown on invalid input.] === BNF [,cpp] ---- URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] relative-ref = relative-part [ "?" query ] [ "#" fragment ] ---- === Specification * link:https://datatracker.ietf.org/doc/html/rfc3986#section-4.1[4.1. URI Reference] == Return Value * `void` == Parameters |=== | Name | Type | *s* | `string_view` |===