| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- #pragma once
- #include <algorithm>
- #include <iterator>
- #include <type_traits>
- #include <iterator/forwards.h>
- #include <iterator/detail/macro.h>
- // Section: Non-Dependant Typedef Helpers
- namespace iterator::detail {
- template <typename Iter>
- using category_t = typename std::iterator_traits<Iter>::iterator_category;
- template <typename C> using iter = decltype(std::begin(std::declval<C>()));
- }
- namespace iterator::detail {
- // Type Helper for identifying container-like objects
- template <typename C, typename = void> struct is_container : std::false_type {};
- template <typename C>
- struct is_container<C, std::void_t<iter<C>>> : std::true_type {};
- template <typename It, typename = void>
- struct sentinel_type {
- using type = void;
- };
- template <typename It>
- struct sentinel_type<It, std::void_t<typename It::sentinel_type>> {
- using type = typename It::sentinel_type;
- };
- }
- namespace iterator::detail {
- template <typename C> constexpr bool is_container_v = is_container<C>{};
- template <typename Iter>
- constexpr bool is_rvalue_iterator_v = !std::is_reference_v<DEREF_TYPE(Iter)>;
- template <typename It>
- constexpr bool has_sentinel_type_v = !std::is_void_v<typename sentinel_type<It>::type>;
- template <typename It, typename S>
- constexpr bool is_sentinel_v = std::is_same_v<typename sentinel_type<It>::type, S>;
- }
- #include <iterator/detail/undef.h>
|