]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/fiber/include/boost/fiber/detail/convert.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / fiber / include / boost / fiber / detail / convert.hpp
1
2 // Copyright Oliver Kowalke 2013.
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6
7 #ifndef BOOST_FIBERS_DETAIL_CONVERT_H
8 #define BOOST_FIBERS_DETAIL_CONVERT_H
9
10 #include <chrono>
11 #include <memory>
12
13 #include <boost/config.hpp>
14
15 #include <boost/fiber/detail/config.hpp>
16
17 #ifdef BOOST_HAS_ABI_HEADERS
18 # include BOOST_ABI_PREFIX
19 #endif
20
21 namespace boost {
22 namespace fibers {
23 namespace detail {
24
25 inline
26 std::chrono::steady_clock::time_point convert(
27 std::chrono::steady_clock::time_point const& timeout_time) noexcept {
28 return timeout_time;
29 }
30
31 template< typename Clock, typename Duration >
32 std::chrono::steady_clock::time_point convert(
33 std::chrono::time_point< Clock, Duration > const& timeout_time) {
34 return std::chrono::steady_clock::now() + ( timeout_time - Clock::now() );
35 }
36
37 // suggested by Howard Hinnant
38 template< typename T >
39 inline
40 T * convert( T * p) noexcept {
41 return p;
42 }
43
44 template< typename Pointer >
45 inline
46 typename std::pointer_traits< Pointer >::element_type *
47 convert( Pointer p) noexcept {
48 return nullptr != p
49 ? to_raw_pointer( p.operator->() )
50 : nullptr;
51 }
52
53 }}}
54
55 #ifdef BOOST_HAS_ABI_HEADERS
56 # include BOOST_ABI_SUFFIX
57 #endif
58
59 #endif // BOOST_FIBERS_DETAIL_CONVERT_H