:relfileprefix: ../../../
[#boost-urls-url-set_scheme_id]

== xref:boost.adoc[pass:[boost]]::xref:boost/urls.adoc[pass:[urls]]::xref:boost/urls/url.adoc[pass:[url]]::set_scheme_id


Set the scheme


=== Synopsis

Declared in header `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/url.hpp#L411[boost/url/url.hpp,window=blank_]>`

[source,cpp,subs="verbatim,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/unknown.adoc[scheme::unknown]
or else an exception is
thrown. If the id is
xref:boost/urls/scheme/none.adoc[scheme::none]
, this
function behaves as if
xref:boost/urls/url_base/remove_scheme.adoc[remove_scheme]
were called.
[,cpp]
----
assert( url( "http://example.com/echo.cgi" ).set_scheme_id( scheme::wss ).buffer() == "wss://example.com/echo.cgi" );
----

=== Linear in `this-&gt;size()`.

=== Strong guarantee.

Calls to allocate may throw.
Exceptions thrown on invalid input.

* link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.1[            3.1. Scheme (rfc3986)]



=== Exceptions

|===
| Name | Thrown on

| `The`
| 
scheme is invalid.

|===



=== Parameters

|===
| Name | Description 

| *id*
| 
The scheme to set.

|===




