[#boost-urls-static_url-set_scheme_id] = xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::xref:boost/urls/static_url.adoc[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#L347[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.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 * link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.1[ 3.1. Scheme (rfc3986)] == Exceptions |=== | Name | Thrown on | `system_error` | The scheme is invalid. |=== == Parameters |=== | Name | Description | *id* | The scheme to set. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#