Boost logo

Boost :

From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2006-03-06 09:29:20


Caleb Epstein wrote:
> On 3/4/06, Jeff Flinn <TriumphSprint2000_at_[hidden]> wrote:

...

> You can then use the get_local_endpoint method to get the value of
> the port that was allocated by the OS.

This brings up one of the bothersome aspects of asio interface, IMHO.
Functions like:

template<typename Endpoint>
void get_local_endpoint (Endpoint &endpoint)

make it difficult to use in the context of an initializer list.

typedef boost::asio::ipv4::tcp::endpoint tEndpoint;

some_class( ... )
: mSocketPtr( ... )
...
, mPort( mSocketPtr->get_local_endpoint().port() )
{}

obviously fails to compile. Rather than

, mPort( mSocketPtr->local_endpoint_ref<tEndpoint>().port() )

Any reason this was not considered? The same goes for host and host
resolver's get_host_by_name.

Thanks, Jeff


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk