Clementine
non_const_lvalue.hpp
1 //
2 // detail/non_const_lvalue.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_NON_CONST_LVALUE_HPP
12 #define ASIO_DETAIL_NON_CONST_LVALUE_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 "asio/detail/type_traits.hpp"
20 
21 #include "asio/detail/push_options.hpp"
22 
23 namespace asio {
24 namespace detail {
25 
26 template <typename T>
28 {
29 #if defined(ASIO_HAS_MOVE)
30  explicit non_const_lvalue(T& t)
31  : value(static_cast<typename conditional<
32  is_same<T, typename decay<T>::type>::value,
33  typename decay<T>::type&, T&&>::type>(t))
34  {
35  }
36 
37  typename conditional<is_same<T, typename decay<T>::type>::value,
38  typename decay<T>::type&, typename decay<T>::type>::type value;
39 #else // defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
40  explicit non_const_lvalue(const typename decay<T>::type& t)
41  : value(t)
42  {
43  }
44 
45  typename decay<T>::type value;
46 #endif // defined(ASIO_HAS_MOVE)
47 };
48 
49 } // namespace detail
50 } // namespace asio
51 
52 #include "asio/detail/pop_options.hpp"
53 
54 #endif // ASIO_DETAIL_NON_CONST_LVALUE_HPP
Definition: chrono.h:284
Definition: non_const_lvalue.hpp:27
Definition: any_io_executor.hpp:28