5 // Copyright (c) 2003-2017 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/shared_ptr.hpp>
23 # include <boost/weak_ptr.hpp>
24 #endif // !defined(BOOST_ASIO_HAS_STD_SHARED_PTR)
26 #if !defined(BOOST_ASIO_HAS_STD_ADDRESSOF)
27 # include <boost/utility/addressof.hpp>
28 #endif // !defined(BOOST_ASIO_HAS_STD_ADDRESSOF)
34 #if defined(BOOST_ASIO_HAS_STD_SHARED_PTR)
35 using std::shared_ptr;
37 #else // defined(BOOST_ASIO_HAS_STD_SHARED_PTR)
38 using boost::shared_ptr;
39 using boost::weak_ptr;
40 #endif // defined(BOOST_ASIO_HAS_STD_SHARED_PTR)
42 #if defined(BOOST_ASIO_HAS_STD_ADDRESSOF)
44 #else // defined(BOOST_ASIO_HAS_STD_ADDRESSOF)
45 using boost::addressof;
46 #endif // defined(BOOST_ASIO_HAS_STD_ADDRESSOF)
50 #if defined(BOOST_ASIO_HAS_CXX11_ALLOCATORS)
51 using std::allocator_arg_t;
52 # define BOOST_ASIO_USES_ALLOCATOR(t) \
54 template <typename Allocator> \
55 struct uses_allocator<t, Allocator> : true_type {}; \
58 # define BOOST_ASIO_REBIND_ALLOC(alloc, t) \
59 typename std::allocator_traits<alloc>::template rebind_alloc<t>
61 #else // defined(BOOST_ASIO_HAS_CXX11_ALLOCATORS)
62 struct allocator_arg_t {};
63 # define BOOST_ASIO_USES_ALLOCATOR(t)
64 # define BOOST_ASIO_REBIND_ALLOC(alloc, t) \
65 typename alloc::template rebind<t>::other
67 #endif // defined(BOOST_ASIO_HAS_CXX11_ALLOCATORS)
72 #endif // BOOST_ASIO_DETAIL_MEMORY_HPP