Boost logo

Boost Users :

Subject: [Boost-users] [asio] endpoint lifetime requirements with acceptor
From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2010-07-23 16:47:57


What is the lifetime requirement of a boost::asio::ip::tcp::endpoint
imposed by boost::asio::ip::tcp::acceptor. in particular it's ctor:
boost::asio::ip::tcp::acceptor(boost::asio::io_service& io_, const
endpoint_type&, bool);

The end point is taken by const&. Is it just used, copied, or does the
acceptor hold a const&? Are these sorts of issues documented? The only
clue I can find is that the endpoint has a copy ctor.

I can successfully construct the acceptor, passing in a temporary
endpoint which is constructed in place in the acceptor's ctor, which
appears to execute on both Win/MSVC8 and Mac/XCode3.2. But if I
construct an endpoint further up the call stack passing it by const&, I
get a runtime error.

Any help appreciated.

Thanks, Jeff


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net