boost::urls::authority_view::encoded_host_and_port :: Boost Libraries Documentation

# boost::urls::authority_view::encoded_host_and_port

Return the host and port

## Synopsis

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

    constexpr
    pct_string_view
    encoded_host_and_port() const noexcept;

## Description

If an authority is present, this function returns the host and optional port as a string, which may be empty. Otherwise it returns an empty string. The returned string may contain percent escapes.

## Example

    assert( url_view( "http://www.example.com:8080/index.htm" ).encoded_host_and_port() == "www.example.com:8080" );

## Complexity

Constant.

## Exception Safety

Throws nothing.

## BNF

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

## Specification

- 3.2.2. Host (rfc3986)

- 3.2.3. Port (rfc3986)

## Return Value

The host and port

## See Also

`has_port`, `port`, `port_number`.

Created with MrDocs