Clementine
memory.hpp
1 //
2 // detail/memory.hpp
3 // ~~~~~~~~~~~~~~~~~
4 //
5 // Copyright (c) 2003-2020 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6 //
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)
9 //
10 
11 #ifndef ASIO_DETAIL_MEMORY_HPP
12 #define ASIO_DETAIL_MEMORY_HPP
13 
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
15 # pragma once
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17 
18 #include "asio/detail/config.hpp"
19 #include <memory>
20 
21 #if !defined(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(ASIO_HAS_STD_SHARED_PTR)
26 
27 #if !defined(ASIO_HAS_STD_ADDRESSOF)
28 # include <boost/utility/addressof.hpp>
29 #endif // !defined(ASIO_HAS_STD_ADDRESSOF)
30 
31 namespace asio {
32 namespace detail {
33 
34 #if defined(ASIO_HAS_STD_SHARED_PTR)
35 using std::make_shared;
36 using std::shared_ptr;
37 using std::weak_ptr;
38 #else // defined(ASIO_HAS_STD_SHARED_PTR)
39 using boost::make_shared;
40 using boost::shared_ptr;
41 using boost::weak_ptr;
42 #endif // defined(ASIO_HAS_STD_SHARED_PTR)
43 
44 #if defined(ASIO_HAS_STD_ADDRESSOF)
45 using std::addressof;
46 #else // defined(ASIO_HAS_STD_ADDRESSOF)
47 using boost::addressof;
48 #endif // defined(ASIO_HAS_STD_ADDRESSOF)
49 
50 } // namespace detail
51 
52 #if defined(ASIO_HAS_CXX11_ALLOCATORS)
53 using std::allocator_arg_t;
54 # define ASIO_USES_ALLOCATOR(t) \
55  namespace std { \
56  template <typename Allocator> \
57  struct uses_allocator<t, Allocator> : true_type {}; \
58  } \
59 
60 # define ASIO_REBIND_ALLOC(alloc, t) \
61  typename std::allocator_traits<alloc>::template rebind_alloc<t>
62 
63 #else // defined(ASIO_HAS_CXX11_ALLOCATORS)
64 struct allocator_arg_t {};
65 # define ASIO_USES_ALLOCATOR(t)
66 # define ASIO_REBIND_ALLOC(alloc, t) \
67  typename alloc::template rebind<t>::other
68 
69 #endif // defined(ASIO_HAS_CXX11_ALLOCATORS)
70 
71 } // namespace asio
72 
73 #endif // ASIO_DETAIL_MEMORY_HPP
Definition: chrono.h:284
Definition: memory.hpp:64
Definition: any_io_executor.hpp:28