File indexing completed on 2025-01-18 10:09:56
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef RANGES_V3_VIEW_INDICES_HPP
0016 #define RANGES_V3_VIEW_INDICES_HPP
0017
0018 #include <meta/meta.hpp>
0019
0020 #include <range/v3/range_fwd.hpp>
0021
0022 #include <range/v3/range/concepts.hpp>
0023 #include <range/v3/utility/static_const.hpp>
0024 #include <range/v3/view/iota.hpp>
0025
0026 #include <range/v3/detail/prologue.hpp>
0027
0028 namespace ranges
0029 {
0030 namespace views
0031 {
0032
0033 struct indices_fn : iota_view<std::size_t>
0034 {
0035 indices_fn() = default;
0036
0037 template(typename Val)(
0038 requires integral<Val>)
0039 iota_view<Val, Val> operator()(Val to) const
0040 {
0041 return {Val(), to};
0042 }
0043 template(typename Val)(
0044 requires integral<Val>)
0045 iota_view<Val, Val> operator()(Val from, Val to) const
0046 {
0047 return {from, to};
0048 }
0049 };
0050
0051
0052 struct closed_indices_fn
0053 {
0054 template(typename Val)(
0055 requires integral<Val>)
0056 closed_iota_view<Val> operator()(Val to) const
0057 {
0058 return {Val(), to};
0059 }
0060 template(typename Val)(
0061 requires integral<Val>)
0062 closed_iota_view<Val> operator()(Val from, Val to) const
0063 {
0064 return {from, to};
0065 }
0066 };
0067
0068
0069
0070 RANGES_INLINE_VARIABLE(indices_fn, indices)
0071
0072
0073
0074 RANGES_INLINE_VARIABLE(closed_indices_fn, closed_indices)
0075 }
0076 }
0077
0078 #include <range/v3/detail/epilogue.hpp>
0079
0080 #endif