[#boost-urls-url-set_scheme_id] = xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::xref:boost/urls/url.adoc[url]::set_scheme_id :relfileprefix: ../../../ :mrdocs: Set the scheme == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L415[boost/url/url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:boost/urls/url.adoc[url]& set_scheme_id(xref:boost/urls.adoc[urls]::xref:boost/urls/scheme.adoc[scheme] id); ---- == Description This function sets the scheme to the specified known xref:boost/urls/scheme.adoc[`urls::scheme`] id, which may not be xref:boost/urls/scheme.adoc[`scheme::unknown`] or else an exception is thrown. If the id is xref:boost/urls/scheme.adoc[`scheme::none`], this function behaves as if xref:boost/urls/url_base/remove_scheme.adoc[`remove_scheme`] were called. == Example [,cpp] ---- assert( url( "http://example.com/echo.cgi" ).set_scheme_id( scheme::wss ).buffer() == "wss://example.com/echo.cgi" ); ---- == Complexity Linear in `this‐>size()`. == Exception Safety Strong guarantee. Calls to allocate may throw. Exceptions thrown on invalid input. == Specification * https://datatracker.ietf.org/doc/html/rfc3986#section-3.1[] == Return Value `*this` == Parameters [cols=2] |=== | Name | Description | *id* | The scheme to set. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#