boost::urls::url_base::set_scheme_id :: Boost Libraries Documentation

# boost::urls::url_base::set_scheme_id

Set the scheme

## Synopsis

Declared in `<boost/url/url_base.hpp>`

    url_base&
    set_scheme_id(urls::scheme id);

## Description

This function sets the scheme to the specified known `urls::scheme` id, which may not be `scheme::unknown` or else an exception is thrown. If the id is `scheme::none`, this function behaves as if `remove_scheme` were called.

## Example

    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

## Exceptions

Name | Thrown on
`system_error` | The scheme is invalid.

## Return Value

`*this`

## Parameters

Name | Description
id | The scheme to set.

Created with MrDocs