Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext
static_url_base::set_port (1 of 2 overloads)

(Inherited from url_base)

Set the port.

Synopsis
url_base&
set_port(
    std::uint16_t n);
Description

The port is set to the specified integer.

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

Linear in this->size().

Exception Safety

Strong guarantee. Calls to allocate may throw.

Parameters

Name

Description

n

The port number to set.

BNF
authority     = [ userinfo "@" ] host [ ":" port ]

port          = *DIGIT
Specification
See Also

remove_port, set_port.


PrevUpHomeNext