Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.
PrevUpHomeNext
static_url::set_port

Set the port.

Synopsis
static_url&
set_port(
    string_view s);
Description

This port is set to the string, which must contain only digits or be empty. An empty port string is distinct from having no port.

Example
assert( url( "http://www.example.com" ).set_port( "8080" ).authority().buffer() == "www.example.com:8080" );
Postconditions
this->has_port() == true && this->port_number() == n && this->port() == std::to_string(n)
Exception Safety

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

Exceptions

Type

Thrown On

system_error

s does not contain a valid port.

Parameters

Name

Description

s

The port string to set.

BNF
port          = *DIGIT
Specification
See Also

remove_port, set_port.


PrevUpHomeNext