diff --git a/gucc/include/gucc/string_utils.hpp b/gucc/include/gucc/string_utils.hpp index 96a0884..d9e8927 100644 --- a/gucc/include/gucc/string_utils.hpp +++ b/gucc/include/gucc/string_utils.hpp @@ -89,6 +89,16 @@ constexpr auto contains(string_findable auto const& str, std::string_view needle return str.find(needle) != str_type::npos; } +template +constexpr auto index_viewable_range(R&& rng, ranges::range_difference_t n) noexcept { + return ranges::next(ranges::begin(rng), n); +} + +template +constexpr auto size_viewable_range(R&& rng) noexcept { + return ranges::distance(ranges::begin(rng), ranges::end(rng)); +} + } // namespace gucc::utils #endif // STRING_UTILS_HPP