|
Boost : |
From: Arvid Norberg (c99ang_at_[hidden])
Date: 2006-03-06 20:47:21
On Mar 6, 2006, at 15:29, Jeff Flinn wrote:
> 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() )
> {}
On the asio cvs there's a new member function, local_endpoint(),
which returns the endpoint.
> 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.
-- Arvid Norberg
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk