Realistic 3D camera system
3D camera system components
use_future.hpp
Go to the documentation of this file.
1 //
2 // use_future.hpp
3 // ~~~~~~~~~~~~~~
4 //
5 // Copyright (c) 2003-2015 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_USE_FUTURE_HPP
12 #define ASIO_USE_FUTURE_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 
22 
23 namespace asio {
24 
26 
40 template <typename Allocator = std::allocator<void> >
42 {
43 public:
46  typedef Allocator allocator_type;
47 
50  {
51  }
52 
54  explicit use_future_t(const Allocator& allocator)
55  : allocator_(allocator)
56  {
57  }
58 
60  template <typename OtherAllocator>
61  use_future_t<OtherAllocator> operator[](const OtherAllocator& allocator) const
62  {
63  return use_future_t<OtherAllocator>(allocator);
64  }
65 
67  allocator_type get_allocator() const
68  {
69  return allocator_;
70  }
71 
72 private:
73  Allocator allocator_;
74 };
75 
77 
80 #if defined(ASIO_HAS_CONSTEXPR) || defined(GENERATING_DOCUMENTATION)
81 constexpr use_future_t<> use_future;
82 #elif defined(ASIO_MSVC)
83 __declspec(selectany) use_future_t<> use_future;
84 #endif
85 
86 } // namespace asio
87 
89 
90 #include "asio/impl/use_future.hpp"
91 
92 #endif // ASIO_USE_FUTURE_HPP
Class used to specify that an asynchronous operation should return a future.
Definition: use_future.hpp:41
ASIO_CONSTEXPR use_future_t()
Construct using default-constructed allocator.
Definition: use_future.hpp:49
use_future_t< OtherAllocator > operator[](const OtherAllocator &allocator) const
Specify an alternate allocator.
Definition: use_future.hpp:61
allocator_type get_allocator() const
Obtain allocator.
Definition: use_future.hpp:67
#define ASIO_CONSTEXPR
Definition: config.hpp:181
use_future_t(const Allocator &allocator)
Construct using specified allocator.
Definition: use_future.hpp:54
Allocator allocator_type
Definition: use_future.hpp:46