| Home | Libraries | People | FAQ | More

##### any_address::emplace_host_and_port

Replaces the current object with a host and port.

###### Synopsis

    void
    emplace_host_and_port(
        std::string hostname,
        unsigned short port = default_port);

###### Description

Destroys the current contained object and constructs a new host and port from the passed components. This function can change the underlying type of object held by `*this`.

The constructed object has `this->type() == address_type::host_and_port`, `this->hostname() == hostname` and `this->port() == port`.

An empty hostname is equivalent to `localhost`.

###### Exception safety

Basic guarantee. Memory allocations may throw.

###### Object lifetimes

Invalidates views pointing into `*this`.