5 // Copyright (c) 2003-2020 Christopher M. Kohlhoff (chris at kohlhoff dot com)
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
11 #ifndef BOOST_ASIO_DETAIL_MEMORY_HPP
12 #define BOOST_ASIO_DETAIL_MEMORY_HPP
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
18 #include <boost/asio/detail/config.hpp>
21 #if !defined(BOOST_ASIO_HAS_STD_SHARED_PTR)
22 # include <boost/make_shared.hpp>
23 # include <boost/shared_ptr.hpp>
24 # include <boost/weak_ptr.hpp>
25 #endif // !defined(BOOST_ASIO_HAS_STD_SHARED_PTR)
27 #if !defined(BOOST_ASIO_HAS_STD_ADDRESSOF)
28 # include <boost/utility/addressof.hpp>
29 #endif // !defined(BOOST_ASIO_HAS_STD_ADDRESSOF)
35 #if defined(BOOST_ASIO_HAS_STD_SHARED_PTR)
36 using std::make_shared;
37 using std::shared_ptr;
39 #else // defined(BOOST_ASIO_HAS_STD_SHARED_PTR)
40 using boost::make_shared;
41 using boost::shared_ptr;
42 using boost::weak_ptr;
43 #endif // defined(BOOST_ASIO_HAS_STD_SHARED_PTR)
45 #if defined(BOOST_ASIO_HAS_STD_ADDRESSOF)
47 #else // defined(BOOST_ASIO_HAS_STD_ADDRESSOF)
48 using boost::addressof;
49 #endif // defined(BOOST_ASIO_HAS_STD_ADDRESSOF)
53 #if defined(BOOST_ASIO_HAS_CXX11_ALLOCATORS)
54 using std::allocator_arg_t;
55 # define BOOST_ASIO_USES_ALLOCATOR(t) \
57 template <typename Allocator> \
58 struct uses_allocator<t, Allocator> : true_type {}; \
61 # define BOOST_ASIO_REBIND_ALLOC(alloc, t) \
62 typename std::allocator_traits<alloc>::template rebind_alloc<t>
64 #else // defined(BOOST_ASIO_HAS_CXX11_ALLOCATORS)
65 struct allocator_arg_t {};
66 # define BOOST_ASIO_USES_ALLOCATOR(t)
67 # define BOOST_ASIO_REBIND_ALLOC(alloc, t) \
68 typename alloc::template rebind<t>::other
70 #endif // defined(BOOST_ASIO_HAS_CXX11_ALLOCATORS)
75 #endif // BOOST_ASIO_DETAIL_MEMORY_HPP