]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/stl_interfaces/fwd.hpp
bump version to 18.2.2-pve1
[ceph.git] / ceph / src / boost / boost / stl_interfaces / fwd.hpp
1 // Copyright (C) 2019 T. Zachary Laine
2 //
3 // Distributed under the Boost Software License, Version 1.0. (See
4 // accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6 #ifndef BOOST_STL_INTERFACES_FWD_HPP
7 #define BOOST_STL_INTERFACES_FWD_HPP
8
9 #include <boost/stl_interfaces/config.hpp>
10
11 #if BOOST_STL_INTERFACES_USE_CONCEPTS
12 #include <ranges>
13 #endif
14 #if defined(__cpp_lib_three_way_comparison)
15 #include <compare>
16 #endif
17
18 #ifndef BOOST_STL_INTERFACES_DOXYGEN
19
20 #if defined(_MSC_VER) || defined(__GNUC__) && __GNUC__ < 8
21 #define BOOST_STL_INTERFACES_NO_HIDDEN_FRIEND_CONSTEXPR
22 #define BOOST_STL_INTERFACES_HIDDEN_FRIEND_CONSTEXPR
23 #else
24 #define BOOST_STL_INTERFACES_HIDDEN_FRIEND_CONSTEXPR constexpr
25 #endif
26
27 #if defined(__GNUC__) && __GNUC__ < 9
28 #define BOOST_STL_INTERFACES_CONCEPT concept bool
29 #else
30 #define BOOST_STL_INTERFACES_CONCEPT concept
31 #endif
32
33 #endif
34
35
36 namespace boost { namespace stl_interfaces {
37
38 /** An enumeration used to indicate whether the underlying data have a
39 contiguous or discontiguous layout when instantiating `view_interface`
40 and `sequence_container_interface`. */
41 enum class element_layout : bool {
42 discontiguous = false,
43 contiguous = true
44 };
45
46 BOOST_STL_INTERFACES_NAMESPACE_V1 {
47
48 namespace v1_dtl {
49 template<typename... T>
50 using void_t = void;
51
52 template<typename Iter>
53 using iter_difference_t =
54 typename std::iterator_traits<Iter>::difference_type;
55
56 template<typename Range, typename = void>
57 struct iterator;
58 template<typename Range>
59 struct iterator<
60 Range,
61 void_t<decltype(std::declval<Range &>().begin())>>
62 {
63 using type = decltype(std::declval<Range &>().begin());
64 };
65 template<typename Range>
66 using iterator_t = typename iterator<Range>::type;
67
68 template<typename Range, typename = void>
69 struct sentinel;
70 template<typename Range>
71 struct sentinel<
72 Range,
73 void_t<decltype(std::declval<Range &>().end())>>
74 {
75 using type = decltype(std::declval<Range &>().end());
76 };
77 template<typename Range>
78 using sentinel_t = typename sentinel<Range>::type;
79
80 template<typename Range>
81 using range_difference_t = iter_difference_t<iterator_t<Range>>;
82
83 template<typename Range>
84 using common_range =
85 std::is_same<iterator_t<Range>, sentinel_t<Range>>;
86
87 template<typename Range, typename = void>
88 struct decrementable_sentinel : std::false_type
89 {
90 };
91 template<typename Range>
92 struct decrementable_sentinel<
93 Range,
94 void_t<decltype(--std::declval<sentinel_t<Range> &>())>>
95 : std::true_type
96 {
97 };
98 }
99
100 }
101 }}
102
103 #endif