boost::urls::url::url

Constructor

Synopsis

Declared in header <boost/url/url.hpp>

explicit
url(core::string_view s);

Description

This function constructs a URL from the string s, which must contain a valid URI or relative-ref or else an exception is thrown. The new url retains ownership by allocating a copy of the passed string.

url u( "https://www.example.com" );
return url( parse_uri_reference( s ).value() );
this->buffer().data() != s.data()

Linear in s.size().

Calls to allocate may throw.

Exceptions thrown on invalid input.

URI           = scheme ":" hier-part [ "?" query ] [ "#" fragment ]

relative-ref  = relative-part [ "?" query ] [ "#" fragment ]

Exceptions

Name Thrown on

The

input does not contain a valid url.

Parameters

Name Description

s

The string to parse.