Skip to content

Commit

Permalink
Replace deprecated use of auto_ptr when unique_ptr is available
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Thorson committed Jan 31, 2016
1 parent bb4cbf3 commit ed335a3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ HEAD
Thank you giachi and Bastien Brunnenstein for reporting. #491
- Compatibility: Fixes a number of build & config issues on Visual Studio 2015
- Compatibility: Removes non-standards compliant masking behavior. #395, #469
- Compatibility: Replace deprecated use of auto_ptr on systems where unique_ptr
is available.

0.6.0
- MINOR BREAKING TRANSPORT POLICY CHANGE: Custom transport policies will now be
Expand Down
1 change: 1 addition & 0 deletions websocketpp/common/memory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ namespace lib {
using std::enable_shared_from_this;
using std::static_pointer_cast;
using std::make_shared;
using std::unique_ptr;

typedef std::unique_ptr<unsigned char[]> unique_ptr_uchar_array;
#else
Expand Down
9 changes: 8 additions & 1 deletion websocketpp/transport/asio/endpoint.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,15 @@ class endpoint : public config::socket_type {
* @param ec Set to indicate what error occurred, if any.
*/
void init_asio(lib::error_code & ec) {
// Use a smart pointer until the call is successful and ownership has successfully been taken
// Use a smart pointer until the call is successful and ownership has
// successfully been taken. Use unique_ptr when available.
// TODO: remove the use of auto_ptr when C++98/03 support is no longer
// necessary.
#ifdef _WEBSOCKETPP_CPP11_MEMORY_
lib::unique_ptr<lib::asio::io_service> service(new lib::asio::io_service());
#else
lib::auto_ptr<lib::asio::io_service> service(new lib::asio::io_service());
#endif
init_asio(service.get(), ec);
if( !ec ) service.release(); // Call was successful, transfer ownership
m_external_io_service = false;
Expand Down

0 comments on commit ed335a3

Please sign in to comment.