[#boost-urls-static_url-set_scheme_id] = xref:boost/urls/static_url/set_scheme_id.adoc[boost::urls::static_url::set_scheme_id] :relfileprefix: ../../../ :mrdocs: Set the scheme == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/static_url.hpp#L349[boost/url/static_url.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:boost/urls/static_url.adoc[static_url]& set_scheme_id(xref:boost/urls/scheme.adoc[urls::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]#