File indexing completed on 2025-12-16 10:09:45
0001
0002
0003
0004
0005
0006 #ifndef BOOST_STL_INTERFACES_FWD_HPP
0007 #define BOOST_STL_INTERFACES_FWD_HPP
0008
0009 #include <boost/stl_interfaces/config.hpp>
0010
0011 #if BOOST_STL_INTERFACES_USE_CONCEPTS
0012 #include <ranges>
0013 #endif
0014 #if defined(__cpp_lib_three_way_comparison)
0015 #include <compare>
0016 #endif
0017
0018 #ifndef BOOST_STL_INTERFACES_DOXYGEN
0019
0020 #if defined(_MSC_VER) || defined(BOOST_GCC) && __GNUC__ < 8
0021 #define BOOST_STL_INTERFACES_NO_HIDDEN_FRIEND_CONSTEXPR
0022 #define BOOST_STL_INTERFACES_HIDDEN_FRIEND_CONSTEXPR
0023 #else
0024 #define BOOST_STL_INTERFACES_HIDDEN_FRIEND_CONSTEXPR constexpr
0025 #endif
0026
0027 #if defined(BOOST_GCC) && __GNUC__ < 9
0028 #define BOOST_STL_INTERFACES_CONCEPT concept bool
0029 #else
0030 #define BOOST_STL_INTERFACES_CONCEPT concept
0031 #endif
0032
0033 #endif
0034
0035
0036 namespace boost { namespace stl_interfaces {
0037
0038
0039
0040
0041 enum class element_layout : bool {
0042 discontiguous = false,
0043 contiguous = true
0044 };
0045
0046 BOOST_STL_INTERFACES_NAMESPACE_V1 {
0047
0048 namespace v1_dtl {
0049 template<typename... T>
0050 using void_t = void;
0051
0052 template<typename Iter>
0053 using iter_difference_t =
0054 typename std::iterator_traits<Iter>::difference_type;
0055
0056 template<typename Range, typename = void>
0057 struct iterator;
0058 template<typename Range>
0059 struct iterator<
0060 Range,
0061 void_t<decltype(std::declval<Range &>().begin())>>
0062 {
0063 using type = decltype(std::declval<Range &>().begin());
0064 };
0065 template<typename Range>
0066 using iterator_t = typename iterator<Range>::type;
0067
0068 template<typename Range, typename = void>
0069 struct sentinel;
0070 template<typename Range>
0071 struct sentinel<
0072 Range,
0073 void_t<decltype(std::declval<Range &>().end())>>
0074 {
0075 using type = decltype(std::declval<Range &>().end());
0076 };
0077 template<typename Range>
0078 using sentinel_t = typename sentinel<Range>::type;
0079
0080 template<typename Range>
0081 using range_difference_t = iter_difference_t<iterator_t<Range>>;
0082
0083 template<typename Range>
0084 using common_range =
0085 std::is_same<iterator_t<Range>, sentinel_t<Range>>;
0086
0087 template<typename Range, typename = void>
0088 struct decrementable_sentinel : std::false_type
0089 {
0090 };
0091 template<typename Range>
0092 struct decrementable_sentinel<
0093 Range,
0094 void_t<decltype(--std::declval<sentinel_t<Range> &>())>>
0095 : std::true_type
0096 {
0097 };
0098 }
0099
0100 }
0101 }}
0102
0103 #endif