shared_ptr -> std::shared_ptr
This is one of the first commits in a plan to remove all `using namespace std;` lines in the entire codebase as it is considered anti-pattern today.
This commit is contained in:
@@ -144,7 +144,7 @@
|
||||
# endif // defined(BOOST_MSVC)
|
||||
#endif // !defined(BOOST_ASIO_DISABLE_STD_ARRAY)
|
||||
|
||||
// Standard library support for shared_ptr and weak_ptr.
|
||||
// Standard library support for std::shared_ptr and weak_ptr.
|
||||
#if !defined(BOOST_ASIO_DISABLE_STD_SHARED_PTR)
|
||||
# if defined(__GNUC__)
|
||||
# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// detail/shared_ptr.hpp
|
||||
// detail/std::shared_ptr.hpp
|
||||
// ~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||
@@ -20,7 +20,7 @@
|
||||
#if defined(BOOST_ASIO_HAS_STD_SHARED_PTR)
|
||||
# include <memory>
|
||||
#else // defined(BOOST_ASIO_HAS_STD_SHARED_PTR)
|
||||
# include <boost/shared_ptr.hpp>
|
||||
# include <boost/std::shared_ptr.hpp>
|
||||
#endif // defined(BOOST_ASIO_HAS_STD_SHARED_PTR)
|
||||
|
||||
namespace boost {
|
||||
@@ -30,7 +30,7 @@ namespace detail {
|
||||
#if defined(BOOST_ASIO_HAS_STD_SHARED_PTR)
|
||||
using std::shared_ptr;
|
||||
#else // defined(BOOST_ASIO_HAS_STD_SHARED_PTR)
|
||||
using boost::shared_ptr;
|
||||
using boost::std::shared_ptr;
|
||||
#endif // defined(BOOST_ASIO_HAS_STD_SHARED_PTR)
|
||||
|
||||
} // namespace detail
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include <boost/asio/detail/config.hpp>
|
||||
|
||||
#include <boost/system/error_code.hpp>
|
||||
#include <boost/asio/detail/shared_ptr.hpp>
|
||||
#include <boost/asio/detail/std::shared_ptr.hpp>
|
||||
#include <boost/asio/detail/socket_types.hpp>
|
||||
#include <boost/asio/detail/weak_ptr.hpp>
|
||||
|
||||
@@ -60,7 +60,7 @@ enum
|
||||
typedef unsigned char state_type;
|
||||
|
||||
struct noop_deleter { void operator()(void*) {} };
|
||||
typedef shared_ptr<void> shared_cancel_token_type;
|
||||
typedef std::shared_ptr<void> shared_cancel_token_type;
|
||||
typedef weak_ptr<void> weak_cancel_token_type;
|
||||
|
||||
BOOST_ASIO_DECL socket_type accept(socket_type s, socket_addr_type* addr,
|
||||
|
||||
@@ -232,19 +232,19 @@ public:
|
||||
* <tt>delete static_cast<io_service::service*>(svc)</tt>.
|
||||
*
|
||||
* @note The destruction sequence described above permits programs to
|
||||
* simplify their resource management by using @c shared_ptr<>. Where an
|
||||
* simplify their resource management by using @c std::shared_ptr<>. Where an
|
||||
* object's lifetime is tied to the lifetime of a connection (or some other
|
||||
* sequence of asynchronous operations), a @c shared_ptr to the object would
|
||||
* sequence of asynchronous operations), a @c std::shared_ptr to the object would
|
||||
* be bound into the handlers for all asynchronous operations associated with
|
||||
* it. This works as follows:
|
||||
*
|
||||
* @li When a single connection ends, all associated asynchronous operations
|
||||
* complete. The corresponding handler objects are destroyed, and all
|
||||
* @c shared_ptr references to the objects are destroyed.
|
||||
* @c std::shared_ptr references to the objects are destroyed.
|
||||
*
|
||||
* @li To shut down the whole program, the io_service function stop() is
|
||||
* called to terminate any run() calls as soon as possible. The io_service
|
||||
* destructor defined above destroys all handlers, causing all @c shared_ptr
|
||||
* destructor defined above destroys all handlers, causing all @c std::shared_ptr
|
||||
* references to all connection objects to be destroyed.
|
||||
*/
|
||||
BOOST_ASIO_DECL ~io_service();
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include <iterator>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <boost/asio/detail/shared_ptr.hpp>
|
||||
#include <boost/asio/detail/std::shared_ptr.hpp>
|
||||
#include <boost/asio/detail/socket_ops.hpp>
|
||||
#include <boost/asio/detail/socket_types.hpp>
|
||||
#include <boost/asio/ip/basic_resolver_entry.hpp>
|
||||
@@ -184,7 +184,7 @@ private:
|
||||
}
|
||||
|
||||
typedef std::vector<basic_resolver_entry<InternetProtocol> > values_type;
|
||||
boost::asio::detail::shared_ptr<values_type> values_;
|
||||
boost::asio::detail::std::shared_ptr<values_type> values_;
|
||||
std::size_t index_;
|
||||
};
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
do_init()
|
||||
{
|
||||
::SSL_library_init();
|
||||
::SSL_load_error_strings();
|
||||
::SSL_load_error_strings();
|
||||
::OpenSSL_add_all_algorithms();
|
||||
|
||||
mutexes_.resize(::CRYPTO_num_locks());
|
||||
@@ -75,7 +75,7 @@ private:
|
||||
#endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
|
||||
}
|
||||
|
||||
static void openssl_locking_func(int mode, int n,
|
||||
static void openssl_locking_func(int mode, int n,
|
||||
const char* /*file*/, int /*line*/)
|
||||
{
|
||||
if (mode & CRYPTO_LOCK)
|
||||
@@ -85,7 +85,7 @@ private:
|
||||
}
|
||||
|
||||
// Mutexes to be used in locking callbacks.
|
||||
std::vector<boost::asio::detail::shared_ptr<
|
||||
std::vector<boost::asio::detail::std::shared_ptr<
|
||||
boost::asio::detail::mutex> > mutexes_;
|
||||
|
||||
#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
|
||||
@@ -94,10 +94,10 @@ private:
|
||||
#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
|
||||
};
|
||||
|
||||
boost::asio::detail::shared_ptr<openssl_init_base::do_init>
|
||||
boost::asio::detail::std::shared_ptr<openssl_init_base::do_init>
|
||||
openssl_init_base::instance()
|
||||
{
|
||||
static boost::asio::detail::shared_ptr<do_init> init(new do_init);
|
||||
static boost::asio::detail::std::shared_ptr<do_init> init(new do_init);
|
||||
return init;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include <boost/asio/detail/config.hpp>
|
||||
#include <cstring>
|
||||
#include <boost/asio/detail/noncopyable.hpp>
|
||||
#include <boost/asio/detail/shared_ptr.hpp>
|
||||
#include <boost/asio/detail/std::shared_ptr.hpp>
|
||||
|
||||
#include <boost/asio/detail/push_options.hpp>
|
||||
|
||||
@@ -39,7 +39,7 @@ protected:
|
||||
// main, and therefore before any other threads can get started. The do_init
|
||||
// instance must be static in this function to ensure that it gets
|
||||
// initialised before any other global objects try to use it.
|
||||
BOOST_ASIO_DECL static boost::asio::detail::shared_ptr<do_init> instance();
|
||||
BOOST_ASIO_DECL static boost::asio::detail::std::shared_ptr<do_init> instance();
|
||||
};
|
||||
|
||||
template <bool Do_Init = true>
|
||||
@@ -68,7 +68,7 @@ private:
|
||||
|
||||
// Reference to singleton do_init object to ensure that openssl does not get
|
||||
// cleaned up until the last user has finished with it.
|
||||
boost::asio::detail::shared_ptr<do_init> ref_;
|
||||
boost::asio::detail::std::shared_ptr<do_init> ref_;
|
||||
};
|
||||
|
||||
template <bool Do_Init>
|
||||
|
||||
Reference in New Issue
Block a user