diff --git a/CMakeLists.txt b/CMakeLists.txt index 0afc781..c18c512 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.20) include(cmake/color.cmake) -set(BLT_VERSION 0.20.24) +set(BLT_VERSION 0.20.25) set(BLT_TEST_VERSION 0.0.1) set(BLT_TARGET BLT) diff --git a/include/blt/meta/iterator.h b/include/blt/meta/iterator.h index 97d82dd..e5873f6 100644 --- a/include/blt/meta/iterator.h +++ b/include/blt/meta/iterator.h @@ -24,21 +24,43 @@ namespace blt::meta { + // this is required! :/ + template - constexpr bool is_input_iterator = std::is_same_v::iterator_cateogry, std::input_iterator_tag>; + struct is_input_iterator { + constexpr static bool value = std::is_same_v::iterator_category, std::input_iterator_tag>; + }; template - constexpr bool is_forward_iterator = std::is_same_v::iterator_cateogry, std::forward_iterator_tag>; + struct is_forward_iterator { + constexpr static bool value = std::is_same_v::iterator_category, std::forward_iterator_tag>; + }; template - constexpr bool is_bidirectional_iterator = std::is_same_v::iterator_cateogry, std::bidirectional_iterator_tag>; + struct is_bidirectional_iterator { + constexpr static bool value = std::is_same_v::iterator_category, std::bidirectional_iterator_tag>; + }; template - constexpr bool is_random_access_iterator = std::is_same_v::iterator_cateogry, std::random_access_iterator_tag>; + struct is_random_access_iterator { + constexpr static bool value = std::is_same_v::iterator_category, std::random_access_iterator_tag>; + }; template - constexpr bool is_bidirectional_or_better = is_bidirectional_iterator || is_random_access_iterator; + inline constexpr bool is_input_iterator_v = is_input_iterator::value; + + template + inline constexpr bool is_forward_iterator_v = is_forward_iterator::value; + + template + inline constexpr bool is_bidirectional_iterator_v = is_bidirectional_iterator::value; + + template + inline constexpr bool is_random_access_iterator_v = is_random_access_iterator::value; + + template + inline constexpr bool is_bidirectional_or_better_v = is_bidirectional_iterator_v || is_random_access_iterator_v; } #endif //BLT_META_ITERATOR_H diff --git a/include/blt/std/ranges.h b/include/blt/std/ranges.h index 074bb91..112b716 100644 --- a/include/blt/std/ranges.h +++ b/include/blt/std/ranges.h @@ -109,7 +109,7 @@ namespace blt class enumerate_wrapper; template - class enumerate_wrapper, std::void_t>> + class enumerate_wrapper, std::void_t>> : public enumerate_forward_iterator { public: @@ -124,7 +124,7 @@ namespace blt }; template - class enumerate_wrapper, std::void_t>> + class enumerate_wrapper, std::void_t>> : public enumerate_bidirectional_iterator { public: @@ -172,8 +172,8 @@ namespace blt {} explicit enumerator_reversible(Iter begin, Iter end, blt::size_t begin_index, blt::size_t end_index): - enumerator_base(IterWrapper(std::move(begin), begin_index), - IterWrapper(std::move(end), end_index)), + enumerator_base(IterWrapper{enumerate_wrapper(std::move(begin), begin_index)}, + IterWrapper{enumerate_wrapper(std::move(end), end_index)}), container_size(std::abs(static_cast(end_index) - static_cast(begin_index))) {} @@ -193,7 +193,7 @@ namespace blt class enumerator_rev; template - class enumerator, std::void_t>> + class enumerator, std::void_t>> : public enumerator_base> { public: @@ -201,7 +201,7 @@ namespace blt }; template - class enumerator, std::void_t>> + class enumerator, std::void_t>> : public enumerator_reversible, enumerator_rev> { public: @@ -209,7 +209,7 @@ namespace blt }; template - class enumerator, std::void_t>> + class enumerator, std::void_t>> : public enumerator_reversible, enumerator_rev> { public: @@ -217,7 +217,7 @@ namespace blt }; template - class enumerator_rev, std::void_t>> + class enumerator_rev, std::void_t>> : public enumerator_reversible>, enumerator> { public: @@ -225,7 +225,7 @@ namespace blt }; template - class enumerator_rev, std::void_t>> + class enumerator_rev, std::void_t>> : public enumerator_reversible>, enumerator> { public: