Skip to content

Commit e036a5a

Browse files
author
Peter Thorson
committed
Also fix this use of auto_ptr
1 parent ed335a3 commit e036a5a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

websocketpp/transport/asio/endpoint.hpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,15 @@ class endpoint : public config::socket_type {
240240
* @see init_asio(io_service_ptr ptr)
241241
*/
242242
void init_asio() {
243-
// Use a smart pointer until the call is successful and ownership transferred
243+
// Use a smart pointer until the call is successful and ownership has
244+
// successfully been taken. Use unique_ptr when available.
245+
// TODO: remove the use of auto_ptr when C++98/03 support is no longer
246+
// necessary.
247+
#ifdef _WEBSOCKETPP_CPP11_MEMORY_
248+
lib::unique_ptr<lib::asio::io_service> service(new lib::asio::io_service());
249+
#else
244250
lib::auto_ptr<lib::asio::io_service> service(new lib::asio::io_service());
251+
#endif
245252
init_asio( service.get() );
246253
// If control got this far without an exception, then ownership has successfully been taken
247254
service.release();

0 commit comments

Comments
 (0)