
On Mar 6, 2006, at 15:29, Jeff Flinn wrote:
Caleb Epstein wrote:
On 3/4/06, Jeff Flinn <TriumphSprint2000@hotmail.com> 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