File indexing completed on 2025-01-18 09:54:52
0001
0002
0003
0004
0005 #ifndef CPPCORO_SEQUENCE_TRAITS_HPP_INCLUDED
0006 #define CPPCORO_SEQUENCE_TRAITS_HPP_INCLUDED
0007
0008 #include <type_traits>
0009
0010 namespace cppcoro
0011 {
0012 template<typename SEQUENCE>
0013 struct sequence_traits
0014 {
0015 using value_type = SEQUENCE;
0016 using difference_type = std::make_signed_t<SEQUENCE>;
0017 using size_type = std::make_unsigned_t<SEQUENCE>;
0018
0019 static constexpr value_type initial_sequence = static_cast<value_type>(-1);
0020
0021 static constexpr difference_type difference(value_type a, value_type b)
0022 {
0023 return static_cast<difference_type>(a - b);
0024 }
0025
0026 static constexpr bool precedes(value_type a, value_type b)
0027 {
0028 return difference(a, b) < 0;
0029 }
0030 };
0031 }
0032
0033 #endif