]> git.proxmox.com Git - ceph.git/blame - 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
CommitLineData
7c673cae
FG
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
21namespace boost {
22namespace fibers {
23namespace detail {
24
25inline
26std::chrono::steady_clock::time_point convert(
27 std::chrono::steady_clock::time_point const& timeout_time) noexcept {
28 return timeout_time;
29}
30
31template< typename Clock, typename Duration >
32std::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
38template< typename T >
39inline
40T * convert( T * p) noexcept {
41 return p;
42}
43
44template< typename Pointer >
45inline
46typename std::pointer_traits< Pointer >::element_type *
47convert( 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