template<typename RANGE > |
using | ghassanpl::range_value = std::ranges::range_value_t< std::decay_t< RANGE > > |
| Helper template to get the value type of a type that decays to a range
|
|
template<typename RANGE > |
using | ghassanpl::range_iterator = std::ranges::iterator_t< std::decay_t< RANGE > > |
| Helper template to get the iterator type of a type that decays to a range
|
|
constexpr __contains_fn | ghassanpl::contains |
| contains(range, el)
|
|
constexpr __contains_subrange_fn | ghassanpl::contains_subrange |
| contains_subrange(range, subrange)
|
|
constexpr bool | ghassanpl::valid_index (random_access_range auto &range, std::integral auto index) |
| Returns whether or not a given integer is a valid index to a random access range
|
|
constexpr auto | ghassanpl::modulo_index (size_t range_size, std::integral auto index) |
| Returns index converted to a valid index into a range of range_size as if using modulo arithmetic.
|
|
constexpr auto | ghassanpl::modulo_index (random_access_range auto &range, std::integral auto index) |
| Returns an valid index into range , created from index as if range is circular.
|
|
constexpr decltype(auto) | ghassanpl::at (random_access_range auto &range, std::integral auto index) |
| Returns a reference to the value at index of range
|
|
constexpr auto | ghassanpl::at_ptr (random_access_range auto &range, std::integral auto index) -> decltype(std::to_address(std::ranges::begin(range)+index)) |
| Returns a pointer to the value at index of range if index is valid, else returns null.
|
|
constexpr decltype(auto) | ghassanpl::modulo_at (random_access_range auto &range, std::integral auto index) |
| Returns a reference to the value at modulo_index of range
|
|
template<random_access_range RANGE, typename T >
requires requires (T value, RANGE range) { { *std::ranges::begin(range) == value } -> std::convertible_to<bool>; } |
constexpr auto | ghassanpl::index_of (RANGE const &range, T &&value) -> std::iter_difference_t< range_iterator< RANGE > > |
| Find a value in range and returns an index to it.
|
|
template<random_access_range RANGE, typename T = range_value<RANGE>> |
constexpr auto | ghassanpl::at_or_default (RANGE &&range, std::integral auto index, T &&default_value) |
| Return the element at index or default_value if not a valid index.
|
|
template<random_access_range RANGE, typename FUNC >
requires range_predicate<RANGE, FUNC> |
constexpr auto | ghassanpl::find_index (RANGE const &range, FUNC &&func) -> std::iter_difference_t< range_iterator< RANGE > > |
| Find a value in range and returns an index to it.
|
|
template<std::ranges::range RANGE, typename FUNC >
requires range_predicate<RANGE, FUNC> |
constexpr auto | ghassanpl::find_ptr (RANGE &range, FUNC &&func) |
| Find a value in range and returns a pointer to it, or null if none found.
|
|
template<random_access_range RANGE, typename FUNC , typename DEF_TYPE = range_value<RANGE>>
requires range_predicate<RANGE, FUNC> |
auto | ghassanpl::find_if_or_default (RANGE &range, FUNC &&func, DEF_TYPE &&default_value=DEF_TYPE{}) |
|
constexpr auto | ghassanpl::to_index (random_access_iterator auto iterator, random_access_range auto const &range) |
| Turns an iterator to range to an index.
|
|
template<contiguous_range RANGE> |
constexpr bool | ghassanpl::valid_address (RANGE &&range, range_value< RANGE > *pointer) |
| Returns whether or not pointer is a valid pointer to an element in the contiguous range
|
|
template<typename T , size_t N = std::dynamic_extent> |
constexpr std::pair< std::span< T >, std::span< T > > | ghassanpl::split_at (std::span< T, N > span, size_t index) |
| Span stuff.
|
|
template<typename T , size_t N = std::dynamic_extent> |
constexpr std::array< std::span< T >, 3 > | ghassanpl::split_at (std::span< T, N > span, size_t index, size_t size) |
|
template<typename T , size_t N = std::dynamic_extent> |
constexpr std::pair< T *, T * > | ghassanpl::as_range (std::span< T, N > span) |
|
template<typename TO , typename FROM , size_t N = std::dynamic_extent> |
auto | ghassanpl::span_cast (std::span< FROM, N > bytes) noexcept |
| Casts a span of objects of type FROM to a span of objects of type TO Does not perform any checks, specifically, no alignment or size checks are performed.
|
|
template<typename T1 , size_t N1, typename T2 , size_t N2> |
constexpr bool | ghassanpl::are_adjacent (std::span< T1, N1 > s1, std::span< T2, N2 > s2) |
|
template<typename T1 , size_t N1, typename T2 , size_t N2> |
constexpr bool | ghassanpl::are_overlapping (std::span< T1, N1 > s1, std::span< T2, N2 > s2) |
|
template<typename T , size_t N1, typename U , size_t N2>
requires std::same_as<std::remove_cvref_t<T>, std::remove_cvref_t<U>> |
constexpr bool | ghassanpl::ends_with (std::span< T, N1 > s1, std::span< U, N2 > s2) |
|
template<typename T , size_t N1, typename U , size_t N2>
requires std::same_as<std::remove_cvref_t<T>, std::remove_cvref_t<U>> |
constexpr bool | ghassanpl::starts_with (std::span< T, N1 > s1, std::span< U, N2 > s2) |
|
template<typename T , std::size_t... Ns> |
constexpr auto | ghassanpl::join (std::array< T, Ns >... arrays) |
| Arrays.
|
|
template<typename T , size_t LL, typename... ARGS>
requires (std::same_as<std::remove_cvref_t<ARGS>, T> && ...) |
constexpr auto | ghassanpl::join (std::array< T, LL > rhs, ARGS &&... args) |
|
template<class CONTAINER , std::ranges::input_range RANGE, class... TYPES>
requires (!std::ranges::view<CONTAINER>) |
constexpr CONTAINER | ghassanpl::to (RANGE &&range, TYPES &&... args) |
| to<container>();
|
|
template<template< class... > class CONTAINER, std::ranges::input_range RANGE, class... TYPES, class _Deduced = std::remove_pointer_t<decltype(detail::to_helper<CONTAINER, RANGE, TYPES...>())>> |
constexpr _Deduced | ghassanpl::to (RANGE &&_Range, TYPES &&... ARGS) |
| to<container>();
|
|
Ranges and such.