Return true if a port is present

Synopsis

Declared in header </boost/url/url_view_base.hpp#L1491[boost/url/url_view_base.hpp,window=blank_]>

bool
has_port() const noexcept;

Description

This function returns true if an authority is present and contains a port.

Example

assert( url_view( "wss://www.example.com:443" ).has_port() );

Complexity

Constant.

Exception Safety

Throws nothing.

BNF

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

port        = *DIGIT

Specification

Return Value

  • bool