header_utils
Loading...
Searching...
No Matches
ghassanpl Namespace Reference

Primary namespace for everything in this library. More...

Namespaces

namespace  colors
 Contains the basic colors as variables and functions.
 
namespace  config
 
namespace  constexpr_math
 
namespace  di
 
namespace  eval
 
namespace  formats
 
namespace  fs
 
namespace  geometry
 Angles.
 
namespace  noise
 Shamelessly stolen from https://github.com/SRombauts/SimplexNoise/.
 
namespace  parsing
 
namespace  random
 
namespace  regex
 
namespace  string_ops
 
namespace  win
 

Classes

struct  bit_reference
 Models a reference to a specific bit in a variable. Can be a statically-defined bit number (BIT_NUM != dynamic_bit_number) More...
 
struct  bit_view
 A view over an integral value allowing for iteration and modification of its individual bits. More...
 
struct  counted_scope_guard
 A RAII class that executes a function on destruction, if its request counter is greater than zero. More...
 
struct  decomposed_uri
 Holds the constituents of a URI. More...
 
struct  enum_array
 Same as std::array except it takes an enum type instead of the size, and uses magic_enum to determine the array size; also allows for indexing with the enum type. More...
 
struct  enum_flags
 A (constexpr) value struct that represents a set of bits mapped to an enum (implemented as a bitset) More...
 
struct  get_index
 std::variant get index of type More...
 
struct  mmap_sink
 A read-write view over a file. More...
 
struct  mmap_source
 A read-only memory view over a file. More...
 
class  mutlticast_function< R(ARGS...)>
 Like std::function<R(ARGS...)> but can reference multiple invocables, and call them all at once. More...
 
struct  scope_counter
 TODO: atomic_scoped_value_change. More...
 
struct  scope_guard
 A RAII class that executes a function on destruction. More...
 
struct  scoped_value_change
 A RAII class that changes the value of a variable and reverts it to the original value on destruction. More...
 
struct  string_stringifier
 NOTE: The below is a MAJOR WORK IN PROGRESS. More...
 
struct  unique_resource
 An equivalent to unique_ptr for values that are not heap pointers. More...
 
struct  with_sl
 Use as a function parameter type to capture both the parameter and the call-site source location. More...
 
struct  with_slh
 Use as a function parameter type to capture both the parameter and the hash of the call-site source location. More...
 

Concepts

concept  bit_integral
 Whether or not a type is integral (but not a bool).
 
concept  output_buffer
 Checks if an element value is appendable to a buffer.
 
concept  bytelike
 Represents any trivially copyable type that is trivially castable to an internal object representation (so a char range)
 
concept  range_predicate
 Concept to check if a function is a predicate on the range elements (i.e. returns boolable)
 

Typedefs

template<size_t N>
using uintN_t = typename detail::uintN_t_t< N >::value
 An unsigned integer type for the given PoT bit size.
 
template<size_t N>
using intN_t = typename detail::intN_t_t< N >::value
 An integer type for the given PoT bit size.
 
template<bool SIGNED, size_t N>
using sintN_t = typename detail::sintN_t_t< SIGNED, N >::value
 A signed integer type for the given PoT bit size.
 
template<typename S , typename D >
using copy_const_t = std::conditional_t< std::is_const_v< S >, std::add_const_t< D >, std::remove_const_t< D > >
 
template<class T >
using remove_cvref_t = std::remove_cv_t< std::remove_reference_t< T > >
 
using file_handle_type = int
 
using byte_mmap_source = mmap_source< std::byte >
 
using u8_mmap_source = mmap_source< std::uint8_t >
 
using char_mmap_source = mmap_source< char >
 
using char8_mmap_source = mmap_source< char8_t >
 
template<typename T >
using optional_scoped_value_change = scoped_value_change< T, true >
 
using default_symbol_provider = default_symbol_provider_t< void >
 
using symbol = symbol_base< default_symbol_provider >
 
template<size_t I, typename... Ts>
using nth_type_of = std::tuple_element_t< I, std::tuple< Ts... > >
 
template<typename... Ts>
using first_type_of = std::tuple_element_t< 0, std::tuple< Ts... > >
 
template<typename... Ts>
using last_type_of = std::tuple_element_t<(sizeof...(Ts) - 1), std::tuple< Ts... > >
 
using uri = std::string
 URIs are stored in a UTF-8 encoding where both non-ASCII code unit bytes as well as URI-reserved characters (delimiters, etc) are %-encoded.
 
using uri_view = std::string_view
 
template<typename T >
using uri_expected = expected< T, uri_error_code >
 
using uri_error = expected< void, uri_error_code >
 

Enumerations

enum class  enum_flag_change : uint8_t { no_change , set , unset , toggle }
 
enum class  uri_error_code {
  no_error , unknown_uri_scheme , scheme_malformed , scheme_invalid ,
  scheme_empty , authority_malformed , authority_empty , authority_not_allowed_in_scheme ,
  authority_invalid_for_scheme , authority_required_in_scheme , user_info_malformed , user_info_not_allowed_in_scheme ,
  user_info_invalid_for_scheme , user_info_required_in_scheme , host_malformed , host_not_allowed_in_scheme ,
  host_invalid_for_scheme , host_required_in_scheme , port_malformed , port_not_allowed_in_scheme ,
  port_invalid_for_scheme , port_required_in_scheme , path_malformed , path_element_malformed ,
  query_malformed , query_not_allowed_in_scheme , query_invalid_for_scheme , query_required_in_scheme ,
  fragment_malformed , fragment_not_allowed_in_scheme , fragment_invalid_for_scheme , fragment_required_in_scheme ,
  invalid_percent_encoding , no_scheme_specific_elements , scheme_specific_element_malformed
}
 
enum class  uri_decompose_flags {
  split_query_elements , split_path_elements , uri_decompose_flags::use_well_known_port_numbers , lowercase_when_appropriate ,
  normalize_path
}
 Flags that modify how a URI string is decomposed into ghassanpl::decomposed_uri. More...
 
enum class  uri_compose_flags {
  path_leading_slash , path_trailing_slash , lowercase_when_appropriate , normalize_path ,
  use_known_scheme
}
 

Functions

template<typename T >
constexpr trec2< T > aligned (trec2< T > const &smaller, trec2< T > const &larger, align alignment)
 
template<typename T >
constexpr trec2< T > aligned (glm::tvec2< T > inner_size, trec2< T > const &larger, align alignment)
 
void DefaultReportAssumptionFailure (std::string_view expectation, std::initializer_list< std::pair< std::string_view, std::string > > values, std::string data, source_location loc)
 
void ReportAssumptionFailure (std::string_view expectation, std::initializer_list< std::pair< std::string_view, std::string > > values, std::string data, source_location loc=source_location::current())
 
template<std::ranges::contiguous_range RANGE_TYPE>
 bit_view (RANGE_TYPE &T) -> bit_view< std::ranges::range_value_t< std::decay_t< decltype(T)> > >
 
template<std::ranges::contiguous_range RANGE_TYPE>
 bit_view (RANGE_TYPE const &T) -> bit_view< std::ranges::range_value_t< std::decay_t< decltype(T)> > const >
 
template<std::ranges::contiguous_range RANGE_TYPE>
auto make_bit_reference (RANGE_TYPE &&range, size_t bit_num)
 
template<size_t BIT_NUM, std::ranges::contiguous_range RANGE_TYPE>
auto make_bit_reference (RANGE_TYPE &&range)
 
template<bit_integral VALUE_TYPE>
auto make_bit_reference (VALUE_TYPE &value, size_t bit_num)
 
template<size_t BIT_NUM, bit_integral VALUE_TYPE>
auto make_bit_reference (VALUE_TYPE &value)
 
template<bit_integral T>
constexpr auto most_significant_half (T v) noexcept
 Returns an integer with the N/2 most significant bits of the given N-bit integer.
 
template<bit_integral T>
constexpr auto least_significant_half (T v) noexcept
 Returns an integer with the N/2 least significant bits of the given N-bit integer.
 
template<bytelike TO, typename FROM , size_t N = std::dynamic_extent>
requires std::is_trivially_copyable_v<FROM>
std::span< TOas_bytelikes (std::span< FROM, N > bytes) noexcept
 Converts a span of trivial values to a span of bytelike s.
 
template<bytelike TO, typename T >
requires std::is_trivially_copyable_v<T>
std::span< TO constas_bytelikes (T const &pod) noexcept
 Returns a span of bytelike s that represents the internal object representation of the argument.
 
template<bytelike FROM>
constexpr auto to_u8 (FROM byte) noexcept
 
template<bytelike FROM>
constexpr auto to_char (FROM byte) noexcept
 
template<bytelike FROM>
constexpr auto to_byte (FROM byte) noexcept
 
template<bytelike FROM>
constexpr auto to_uchar (FROM byte) noexcept
 
template<bytelike FROM>
constexpr auto to_char8 (FROM byte) noexcept
 
template<bytelike FROM, size_t N = std::dynamic_extent>
auto as_chars (std::span< FROM, N > bytes) noexcept
 
template<bytelike FROM, size_t N = std::dynamic_extent>
auto as_bytes (std::span< FROM, N > bytes) noexcept
 
template<bytelike FROM, size_t N = std::dynamic_extent>
auto as_uchars (std::span< FROM, N > bytes) noexcept
 
template<bytelike FROM, size_t N = std::dynamic_extent>
auto as_u8s (std::span< FROM, N > bytes) noexcept
 
template<bytelike FROM, size_t N = std::dynamic_extent>
auto as_char8s (std::span< FROM, N > bytes) noexcept
 
template<typename T >
requires std::is_trivial_v<T>
auto as_chars (T const &data) noexcept
 
template<typename T >
requires std::is_trivial_v<T>
auto as_bytes (T const &data) noexcept
 
template<typename T >
requires std::is_trivial_v<T>
auto as_uchars (T const &data) noexcept
 
template<typename T >
requires std::is_trivial_v<T>
auto as_u8s (T const &data) noexcept
 
template<typename T >
requires std::is_trivial_v<T>
auto as_char8s (T const &data) noexcept
 
template<bytelike B, size_t N = std::dynamic_extent>
bool nth_bit (std::span< B const, N > range, size_t n) noexcept
 
template<bytelike B, size_t N = std::dynamic_extent>
void set_nth_bit (std::span< B, N > range, size_t n, bool value) noexcept
 
template<typename T >
requires std::is_trivially_copyable_v<T>
bool nth_bit (T const &pod, size_t n) noexcept
 
template<typename T >
requires std::is_trivially_copyable_v<T>
void set_nth_bit (T &pod, size_t n, bool value) noexcept
 
template<size_t N, bytelike B, size_t SN = std::dynamic_extent>
bool nth_bit (std::span< B const, SN > range) noexcept
 
template<size_t N, bytelike B, size_t SN = std::dynamic_extent>
void set_nth_bit (std::span< B, SN > range, bool value) noexcept
 
template<size_t N, typename T >
requires std::is_trivially_copyable_v<T>
bool nth_bit (T const &pod) noexcept
 
template<size_t N, typename T >
requires std::is_trivially_copyable_v<T>
void set_nth_bit (T &pod, bool value) noexcept
 
template<bytelike B, std::integral T>
constexpr auto to_bytelike_array (T value)
 A constexpr function that converts an integral value to its constituent bytelikes TODO: This is NOT like a reinterpret_/bit_cast to u8s, because it's not endian-aware.
 
template<std::integral T>
constexpr auto to_u8_array (T value)
 
template<size_t ALIGN, bytelike T, size_t N = std::dynamic_extent>
auto align_front_to (std::span< T, N > bytes) noexcept -> align_front_to_result< T >
 Splits the argument span into two spans, the first one being the prefix, the second one having its data pointer aligned to the given alignment.
 
template<size_t ALIGN, bytelike T, size_t N = std::dynamic_extent>
constexpr auto align_back_to (std::span< T, N > bytes) noexcept -> align_back_to_result< T >
 Splits the argument span into two spans, the first one having its size aligned to the given alignment, the second one being the suffix.
 
template<size_t ALIGN, bytelike T, size_t N = std::dynamic_extent>
auto align_to (std::span< T, N > bytes) noexcept -> align_to_result< T >
 Splits the argument span into three spans, the first one being the prefix, the second one having its data and size aligned to the given alignment, the third one being the suffix.
 
template<typename TO , bytelike B, size_t N = std::dynamic_extent>
auto aligned_span_cast (std::span< B, N > bytes) noexcept -> align_to_result< B, TO >
 
template<typename TO , bytelike B, size_t N = std::dynamic_extent>
auto aligned_span_cast_and_construct (std::span< B, N > bytes) noexcept -> align_to_result< B, TO >
 
template<class Ty , class Uty >
constexpr auto && forward_like (Uty &&Ux) noexcept
 
constexpr unsigned short byteswap_ushort (const unsigned short val) noexcept
 
constexpr unsigned long byteswap_ulong (const unsigned long val) noexcept
 
constexpr unsigned long long byteswap_uint64 (const unsigned long long val) noexcept
 
template<class T , std::enable_if_t< std::is_integral_v< T >, int > = 0>
constexprbyteswap (const T val) noexcept
 
template<typename RESULT_TYPE , typename ENUM_TYPE >
EF_CONSTEXPR RESULT_TYPE flag_bit (ENUM_TYPE e) EF_NOEXCEPT
 
template<typename FUNC , typename... ARGS>
auto call_with_expected_ec (FUNC &&func, ARGS &&... args) noexcept(noexcept(func(std::forward< ARGS >(args)...))) -> expected< std::invoke_result_t< FUNC, ARGS &&... >, std::error_code >
 Calls the given function with args and an std::error_code as the last argument.
 
template<typename RESULT_TYPE = unsigned long long, typename... ARGS>
requires detail::valid_flag_bits_arguments<RESULT_TYPE, ARGS...>
constexpr RESULT_TYPE flag_bits (ARGS... args) noexcept
 Takes a list of enum values that represent bit numbers (not actual bit values) and returns a value with all the chosen bits set.
 
template<typename INTEGRAL , typename ENUM_TYPE >
requires detail::valid_flag_bits_arguments<INTEGRAL, ENUM_TYPE>
constexpr bool is_flag_set (INTEGRAL const &bits, ENUM_TYPE flag) noexcept
 Checks if an integral value has the bit at number represented by flag set.
 
template<typename INTEGRAL , typename... ARGS>
requires detail::valid_flag_bits_arguments<INTEGRAL, ARGS...>
constexpr bool are_any_flags_set (INTEGRAL const &bits, ARGS... args) noexcept
 Checks if an integral value has any of the bits at numbers represented by args set.
 
template<typename INTEGRAL , typename... ARGS>
requires detail::valid_flag_bits_arguments<INTEGRAL, ARGS...>
constexpr bool are_all_flags_set (INTEGRAL const &bits, ARGS... args) noexcept
 Checks if an integral value has all of the bits at numbers represented by args set.
 
template<typename INTEGRAL , typename... ARGS>
requires detail::valid_flag_bits_arguments<INTEGRAL, ARGS...>
constexpr void set_flags (INTEGRAL &bits, ARGS... args) noexcept
 Sets the bits at numbers represented by args in bits
 
template<typename INTEGRAL , typename... ARGS>
requires detail::valid_flag_bits_arguments<INTEGRAL, ARGS...>
constexpr void unset_flags (INTEGRAL &bits, ARGS... args) noexcept
 Unsets the bits at numbers represented by args in bits
 
template<typename INTEGRAL , typename... ARGS>
requires detail::valid_flag_bits_arguments<INTEGRAL, ARGS...>
constexpr void toggle_flags (INTEGRAL &bits, ARGS... args) noexcept
 Toggles the bits at numbers represented by args in bits
 
template<typename INTEGRAL , typename... ARGS>
requires detail::valid_flag_bits_arguments<INTEGRAL, ARGS...>
constexpr void set_flags_to (INTEGRAL &bits, bool val, ARGS... args) noexcept
 Sets the bits at numbers represented by args in bits to either 0 or 1, depending on val
 
template<typename... ARGS>
auto make_single_time_function (std::function< void(ARGS...)> func)
 Returns a function that calls func when invoked, but only the first time.
 
template<typename FUNC >
auto make_single_time_function (FUNC &&func)
 Returns a function that calls func when invoked, but only the first time.
 
template<typename T , typename FUNC >
auto transform (std::optional< T > const &value, FUNC &&func) -> decltype(std::optional{ func(value.value()) })
 
template<bytelike_range RANGE>
constexpr uint32_t crc32 (RANGE &&bytes)
 Calculates a CRC32 for a range of bytelikes.
 
template<bytelike... BYTES>
constexpr uint32_t crc32 (BYTES... bytes)
 Calculates a CRC32 for a variadic number of bytelikes.
 
constexpr auto crc32 (const source_location &k)
 Calculates a CRC32 of a source_location (constexpr, so can be used at compile time)
 
template<bytelike_range RANGE>
constexpr uint64_t crc64 (RANGE &&bytes)
 Calculates a CRC4 for a range of bytelikes.
 
template<bytelike... BYTES>
constexpr uint64_t crc64 (BYTES... bytes)
 Calculates a CRC4 for a variadic number of bytelikes.
 
constexpr auto crc64 (const source_location &k)
 Calculates a CRC64 of a source_location (constexpr, so can be used at compile time)
 
template<bytelike_range RANGE>
constexpr uint64_t fnv64 (RANGE &&bytes)
 TODO: Add support for non-64bit hashes to all the functions below, especially since std::hash operates on size_t.
 
template<bytelike... BYTES>
constexpr uint64_t fnv64 (BYTES... bytes)
 Calculates a FNV Hash for a variadic number of bytes.
 
constexpr void fold_in_hash64 (uint64_t &hash1, uint64_t hash2) noexcept
 
template<typename T >
requires (sizeof(T) <= sizeof(uint64_t)) && ((sizeof(T) & (sizeof(T) - 1)) == 0) && std::is_trivially_copyable_v<T>
consteval uint64_t ce_hash64 (T val) noexcept
 
template<bytelike T>
consteval uint64_t ce_hash64 (std::basic_string_view< T > const &val) noexcept
 
template<typename FIRST , typename... T>
requires (sizeof...(T) > 0)
consteval uint64_t ce_hash64 (FIRST const &first, T const &... values)
 
template<typename TUPLE_TYPE , uint64_t... Is>
consteval void ce_hash64_tuple_elements (uint64_t &hash, TUPLE_TYPE const &t, std::index_sequence< Is... >)
 
template<typename... T>
consteval uint64_t ce_hash64 (std::tuple< T... > const &tupl) noexcept
 
template<typename T , typename HASHER = std::hash<std::remove_cvref_t<T>>>
constexpr void hash64_combine_to (uint64_t &seed, T &&v, HASHER &&hasher=HASHER{})
 TODO: ce_hash64(array/span) TODO: ce_hash64(thread::id) ? TODO: ce_hash64(optional/variant) ?
 
template<template< typename > typename HASHER = std::hash, typename FIRST , typename... T>
constexpr uint64_t hash64 (FIRST &&first, T &&... values)
 
template<typename It , typename HASHER = std::hash<std::iter_value_t<It>>>
constexpr void hash64_range (uint64_t &seed, It first, It last, HASHER const &hasher={})
 Combines an existing hash value (seed) with the hash of a range of values.
 
template<typename It , typename HASHER = std::hash<std::iter_value_t<It>>>
constexpr uint64_t hash64_range (It first, It last, HASHER &&hasher={})
 Hashes a range of values.
 
template<std::ranges::range T, typename HASHER = std::hash<std::ranges::range_value_t<T>>>
constexpr uint64_t hash64_range (T range, HASHER &&hasher={})
 Hashes a range of values.
 
template<typename VALUE_TYPE >
mmap_source< VALUE_TYPE > make_mmap_source (const std::filesystem::path &path, typename mmap_source< VALUE_TYPE >::size_type offset, typename mmap_source< VALUE_TYPE >::size_type length, std::error_code &error) noexcept
 
template<typename VALUE_TYPE >
mmap_source< VALUE_TYPE > make_mmap_source (const std::filesystem::path &path, std::error_code &error) noexcept
 
template<typename VALUE_TYPE >
mmap_source< VALUE_TYPE > make_mmap_source (const std::filesystem::path &path, typename mmap_source< VALUE_TYPE >::size_type offset, typename mmap_source< VALUE_TYPE >::size_type length)
 
template<typename VALUE_TYPE >
mmap_source< VALUE_TYPE > make_mmap_source (const std::filesystem::path &path)
 
template<typename VALUE_TYPE >
mmap_sink< VALUE_TYPE > make_mmap_sink (const std::filesystem::path &path, typename mmap_sink< VALUE_TYPE >::size_type offset, typename mmap_sink< VALUE_TYPE >::size_type length, std::error_code &error) noexcept
 
template<typename VALUE_TYPE >
mmap_sink< VALUE_TYPE > make_mmap_sink (const std::filesystem::path &path, std::error_code &error) noexcept
 
template<typename VALUE_TYPE >
mmap_sink< VALUE_TYPE > make_mmap_sink (const std::filesystem::path &path, typename mmap_sink< VALUE_TYPE >::size_type offset, typename mmap_sink< VALUE_TYPE >::size_type length)
 
template<typename VALUE_TYPE >
mmap_sink< VALUE_TYPE > make_mmap_sink (const std::filesystem::path &path)
 
template<typename T , detail::FixedString PARAMETER, typename STRINGIFIER >
auto stringify (STRINGIFIER &str, named< T, PARAMETER > const &val)
 
template<typename ALPHA , typename T , detail::FixedString PARAMETER, typename... TRAITS>
auto lerp (named< T, PARAMETER, TRAITS... > const &value_a, named< T, PARAMETER, TRAITS... > const &value_b, ALPHA &&alpha)
 
template<template< typename > typename HASHER, typename FIRST , typename... T>
constexpr size_t hash (FIRST &&first, T &&... values)
 
template<typename T >
trec2< T > operator+ (glm::tvec2< T > op, trec2< T > rec) noexcept
 
template<typename T , typename STRINGIFIER >
auto stringify (STRINGIFIER &str, trec2< T > &b)
 
template<typename T , typename STRINGIFIER >
auto stringify (STRINGIFIER &str, trec2< T > const &b)
 
template<class EF >
 scope_guard (EF) -> scope_guard< EF >
 
template<class R , class D >
 unique_resource (R, D) -> unique_resource< R, D >
 
template<class R , class D , class I = std::decay_t<R>>
 unique_resource (R, I, D) -> unique_resource< R, D >
 
template<typename T , typename U >
 scoped_value_change (T &, U &&) -> scoped_value_change< T >
 
template<class T >
constexpr bool operator== (const sentinel_optional< T > &left, std::nullopt_t) noexcept
 
template<class T , std::enable_if_t< std::is_constructible_v< std::decay_t< T >, T >, int > = 0>
constexpr sentinel_optional< std::decay_t< T > > make_sentinel_optional (T &&value) noexcept(noexcept(sentinel_optional< std::decay_t< T > >{std::forward< T >(value)}))
 
template<class T , class... TYPES, std::enable_if_t< std::is_constructible_v< T, TYPES... >, int > = 0>
constexpr sentinel_optional< T > make_optional (TYPES &&... args) noexcept(noexcept(sentinel_optional< T >{std::in_place, std::forward< TYPES >(args)...}))
 
template<typename STRINGIFIER >
auto stringify (STRINGIFIER &str, const source_location &b)
 
template<typename FUNC >
std::string interpolate_simple (std::string_view str, FUNC &&func)
 
template<bool SYNTAX>
std::string interpolate_eval (std::string_view str, eval::environment< SYNTAX > &env)
 
template<std::same_as< char > T>
std::string to_string (T c)
 
template<typename T >
requires (!std::same_as<T, char> && std::integral<T>)
std::string to_string (T val)
 
template<typename T >
requires std::constructible_from<std::string_view, T>
std::string to_string (T &&val)
 
std::string to_string (nullptr_t)
 
template<typename T >
bool eat_from_string (std::string_view &from, T &&val)
 
template<typename T , template< bool > typename STRINGIFIER = string_stringifier>
requires requires (STRINGIFIER<true> str, T val) { stringify(str, val); }
std::string to_string (T &&val)
 
template<typename T , template< bool > typename STRINGIFIER = string_stringifier>
requires requires (STRINGIFIER<false> str, T val) { stringify(str, val); }
bool from_string (std::string_view val, T &target)
 
template<typename T , template< bool > typename STRINGIFIER = string_stringifier>
requires requires (STRINGIFIER<false> str, T val) { stringify(str, val); }
from_string (std::string_view val)
 
template<size_t I, typename T , typename... Ts>
auto nth_value_of (T &&t, Ts &&... args)
 
template<typename... Ts>
auto first_value_of (Ts &&... args)
 
template<typename... Ts>
auto last_value_of (Ts &&... args)
 
template<typename... ARGS, typename FUNC >
constexpr void for_each (FUNC &&f)
 Function: for_each TODO: Description.
 
template<typename FUNC , typename... ARGS>
requires ((sizeof...(ARGS) % 2) == 0)
constexpr void for_each_pair (FUNC &&f, ARGS &&... args)
 Function: for_each_pair TODO: Description.
 
template<typename... ARGS, typename FUNC >
constexpr void for_each_in_tuple (std::tuple< ARGS... > const &t, FUNC &&f)
 Function: for_each_in_tuple.
 
template<typename... ARGS, typename FUNC >
constexpr auto transform_tuple (std::tuple< ARGS... > const &t, FUNC &&f)
 Function: transform_tuple.
 
template<typename FUNC , typename... ARGS>
constexpr void enumerate_pack (FUNC &&f, ARGS &&... args)
 Function: enumerate_pack Calls f on every argument args....
 
template<size_t N, typename FUNC , typename... ARGS>
requires (N < sizeof...(ARGS))
constexpr auto apply_to_nth (FUNC &&f, ARGS &&... args)
 Function: apply_to_nth Calls f on the Nth argument in the args pack.
 
template<size_t Begin, size_t End, size_t Stride, double & ..., typename FUNC , typename... ARGS>
constexpr auto apply_to_slice (FUNC &&f, ARGS &&... args)
 Function: apply_to_slice Calls f with a slice of the args pack.
 
template<size_t Begin, size_t End, double & ..., typename FUNC , typename... ARGS>
constexpr auto apply_to_slice (FUNC &&f, ARGS &&... args)
 Function: apply_to_slice Calls f with a slice of the args pack.
 
template<size_t Begin, double & ..., typename FUNC , typename... ARGS>
constexpr auto apply_to_slice (FUNC &&f, ARGS &&... args)
 Function: apply_to_slice Calls f with a slice of the args pack.
 
template<typename C , typename X >
auto is (X const &) -> bool
 Shamelessly stolen from hsutter's cppfront.
 
template<typename C , typename X >
requires std::is_same_v<C, X>
auto is (X const &) -> bool
 
template<typename C , typename X >
requires (std::is_base_of_v<C, X> && !std::is_same_v<C, X>)
auto is (X const &) -> bool
 
template<typename C , typename X >
requires (std::is_base_of_v<X, C> && !std::is_same_v<C, X>)
auto is (X const &x) -> bool
 
template<typename C , typename X >
requires (std::is_base_of_v<X, C> && !std::is_same_v<C, X>)
auto is (X const *x) -> bool
 
template<typename C , typename X >
requires dereferenceable<X> && std::is_default_constructible_v<X> && std::is_same_v<C, void>
auto is (X const &x) -> bool
 
template<typename C >
auto as (...) -> auto
 
template<typename C , typename X >
requires std::is_same_v<C, X>
auto as (X const &x) -> auto &&
 
template<typename C , typename X >
requires (!std::is_same_v<C, X> && std::constructible_from<C, X const&>)
auto as (X const &x) -> auto
 
template<typename C , typename X >
requires std::is_base_of_v<C, X>
auto as (X &&x) -> C &&
 
template<typename C , typename X >
requires (std::is_base_of_v<X, C> && !std::is_same_v<C, X>)
auto as (X &x) -> C &
 
template<typename C , typename X >
requires (std::is_base_of_v<X, C> && !std::is_same_v<C, X>)
auto as (X const &x) -> C const &
 
template<typename C , typename X >
requires (std::is_base_of_v<X, C> && !std::is_same_v<C, X>)
auto as (X *x) -> C *
 
template<typename C , typename X >
requires (std::is_base_of_v<X, C> && !std::is_same_v<C, X>)
auto as (X const *x) -> C const *
 
template<typename T , typename... Ts>
auto is (std::variant< Ts... > const &x)
 
template<typename T , typename... Ts>
auto as (std::variant< Ts... > const &x)
 
template<typename T , typename X >
requires (std::is_same_v<X, std::any> && !std::is_same_v<T, std::any> && !std::is_same_v<T, void>)
constexpr auto is (X const &x) -> bool
 
template<typename T , typename X >
requires (std::is_same_v<X, std::any> && std::is_same_v<T, void>)
constexpr auto is (X const &x) -> bool
 
template<typename T , typename X >
requires (!std::is_reference_v<T> && std::is_same_v<X, std::any> && !std::is_same_v<T, std::any>)
constexpr auto as (X const &x) -> T
 
template<typename T , typename X >
requires std::is_same_v<X, std::optional<T>>
constexpr auto is (X const &x) -> bool
 
template<typename T , typename U >
requires std::is_same_v<T, void>
constexpr auto is (std::optional< U > const &x) -> bool
 
template<typename T , typename X >
requires std::is_same_v<X, std::optional<T>>
constexpr auto as (X const &x) -> auto &&
 
template<typename... ARGS, typename FUNC >
constexpr void for_each_in_tuple (std::tuple< ARGS... > &&t, FUNC &&f)
 
template<size_t I, typename FUNC , typename... ARGS>
requires (I < sizeof...(ARGS))
constexpr auto apply_to_nth (FUNC &&f, ARGS &&... args)
 Function: apply_to_nth Calls f on the Nth argument in the args pack.
 
template<mutex_type MUTEX_TYPE, typename FUNC , typename... ARGS>
auto under_protection (MUTEX_TYPE &m, FUNC &&func, ARGS &&... args)
 
template<mutex_type MUTEX_TYPE, typename T >
auto protected_copy (MUTEX_TYPE &m, T &&t)
 
uri_expected< urimake_uri_safe_for_display (uri_view uri)
 Removes data that should not be displayed to an untrusted user (user-info after the first ':', perhaps other things)
 
uri_expected< decomposed_uridecompose_uri (uri_view uri, enum_flags< uri_decompose_flags > flags=enum_flags< uri_decompose_flags >::all())
 This function will decompose URI into its composite elements, which includes percent-decoding all the elements.
 
uri_expected< uricompose_uri (decomposed_uri const &decomposed, enum_flags< uri_compose_flags > flags=enum_flags< uri_compose_flags >::all())
 
uri_expected< urinormalize_uri (uri_view uri)
 
known_uri_scheme constquery_uri_scheme (std::string_view scheme)
 
uri_expected< uricompose_uri (decomposed_uri const &decomposed, enum_flags< uri_decompose_flags > const flags)
 
last_windows_error_t get_last_windows_error ()
 
Endianness
template<bit_integral B>
constexpr B to_big_endian (B val) noexcept
 Returns val in its big-endian representation.
 
template<bit_integral B>
constexpr B to_little_endian (B val) noexcept
 Returns val in its big-endian representation.
 
template<std::endian ENDIANNESS, bit_integral B>
constexpr B to_endian (B val) noexcept
 Returns val in its ENDIANNESS representation.
 
template<bit_integral B>
constexpr B to_endian (B val, std::endian endianness) noexcept
 Returns val in its endianness representation.
 
template<typename T , typename U >
constexpr auto push_back_unique (std::vector< T > &vector, U &&value)
 
template<typename T , typename U >
constexpr std::optional< T > erase_single (std::vector< T > &vector, U &&value)
 Finds a value in the vector, and erases it, but returns the value.
 
template<typename K , typename V , typename COMP , typename U >
constexpr std::optional< Verase_single (std::map< K, V, COMP > &map, U &&key)
 Finds a value in the map, and erases it, but returns the value.
 
template<typename T , typename PRED >
constexpr std::optional< T > erase_single_if (std::vector< T > &vector, PRED &&pred)
 Finds a value in the vector by predicate, and erases it.
 
template<typename T , typename U >
constexpr std::optional< T > erase_single_swap (std::vector< T > &vector, U &&value)
 Finds and erases a value in vector, not preserving item order (swapping last item to erased)
 
template<typename T , typename PRED >
constexpr std::optional< T > erase_single_swap_if (std::vector< T > &vector, PRED &&pred)
 Finds and erases a value in vector by predicate, not preserving item order (swapping last item to erased)
 
template<typename T >
constexpr std::optional< T > erase_at_swap (std::vector< T > &vector, size_t index)
 Erases the element at index in vector, not preserving item order (swapping last item to erased)
 
template<typename KEY , typename MAP >
auto map_find (MAP &map, KEY &&key)
 Finds the value associated with key in the map and retuns a pointer to it, or nullptr if none found.
 
template<typename DEF , typename KEY , typename MAP >
auto map_at_or_default (MAP &&map, KEY &&key, DEF &&def)
 Finds the value associated with key in the map and retuns it, or def if none found.
 
template<typename KEY , typename MAP >
decltype(automap_at (MAP &&map, KEY &&key)
 Basically map.at() but works with heterogenous key types.
 
template<typename MAP , typename VAL >
auto map_find_value (MAP &map, VAL const *value)
 Finds the first value of a map element, and returns a pointer to its key, or nullptr if none found.
 
template<typename K , typename V , typename C , typename VAL >
auto at_ptr (std::map< K, V, C > const &map, VAL &&value)
 Same as map_find()
 
template<typename K , typename V , typename C , typename VAL >
auto at_ptr (std::map< K, V, C > &map, VAL &&value)
 Same as map_find()
 

Variables

void(* AssumptionFailureHandler )(std::string_view expectation, std::initializer_list< std::pair< std::string_view, std::string > > values, std::string data, source_location loc)
 This function must be provided by your own code, as it is called by an assumption macro with a failing assumption.
 
template<typename T >
constexpr auto bit_count
 Equal to the number of bits in the type.
 
constexpr uint64_t all_bits
 A value of type uint64_t with all bits set.
 
template<size_t BEGIN, size_t END>
constexpr uint64_t bit_mask_v
 Value with bits between BEGIN and END (exclusive) set.
 
template<bit_integral FOR>
constexpr uint64_t bit_mask_for_v
 Value with all bits available for the FOR type set (e.g. first 8 bits for uint8_t will be set, etc.)
 
constexpr size_t dynamic_bit_number
 Used to specify that a ghassanpl::bit_reference references a bit number given at runtime.
 
template<class T , class... TYPES>
constexpr bool is_any_of_v
 
template<class >
constexpr bool always_false
 
constexpr struct ghassanpl::all_flags_t all_flags
 
constexpr struct ghassanpl::no_flags_t no_flags
 
template<typename TYPE >
constexpr bool is_enum_flags_v
 
template<typename RESULT_TYPE , auto... VALUES>
constexpr RESULT_TYPE flag_bits_v
 
template<auto INT_VALUE, auto VALUE>
constexpr auto is_flag_set_v
 
template<auto INT_VALUE, auto... VALUES>
constexpr auto are_any_flags_set_v
 
template<auto INT_VALUE, auto... VALUES>
constexpr auto are_all_flags_set_v
 
template<auto INT_VALUE, auto... VALUES>
constexpr auto set_flag_v
 
template<auto INT_VALUE, auto... VALUES>
constexpr auto unset_flag_v
 
template<auto INT_VALUE, auto... VALUES>
constexpr auto toggle_flag_v
 
template<auto INT_VALUE, bool TO, auto... VALUES>
constexpr auto set_flag_to_v
 
static constexpr uint32_t crc32_table [256]
 
static constexpr uint64_t crc64_table [256]
 
static constexpr size_t map_entire_file
 
const file_handle_type invalid_handle
 
template<typename OTHER >
static constexpr bool is_named_v
 
static constexpr struct ghassanpl::bounding_box_for_t bounding_box_for
 
template<typename TYPE , typename TYPE_CONTAINER >
constexpr size_t get_index_v
 
template<typename TYPE , typename TYPE_CONTAINER >
constexpr bool has_type_v
 
enum class  horizontal_align {
  horizontal_align::left , horizontal_align::center , horizontal_align::centre , horizontal_align::right ,
  horizontal_align::justify
}
 
enum class  vertical_align {
  top , middle , center , centre ,
  bottom , justify
}
 Represents an alignment on a vertical line. More...
 
enum class  align {
  top_left , top_center , top_centre , center_top ,
  centre_top , top_right , middle_left , center_left ,
  centre_left , middle_center , center , centre ,
  middle_right , center_right , centre_right , bottom_left ,
  bottom_center , bottom_centre , center_bottom , centre_bottom ,
  bottom_right
}
 Represents an alignment in both axes (horizontal and veritcal) More...
 
constexpr align aligns_in_order []
 Alignments in order, first left-to-right, then top-to-bottom.
 
constexpr align aligns_clockwise []
 Alignments in clockwise order.
 
constexpr align aligns_counter_clockwise []
 Alignments in counter-clockwise order.
 
constexpr horizontal_align horizontal_aligns_in_order []
 Horizontal alignments in order.
 
constexpr vertical_align vertical_aligns_in_order []
 Vertical alignments in order.
 
constexpr const charhorizontal_align_names []
 
constexpr const charvertical_align_names []
 
constexpr const charalign_names []
 
constexpr const charalign_names_natural []
 
constexpr align operator| (horizontal_align first, vertical_align second)
 You can use the | operator to create an align from a horizontal_align and a vertical_align.
 
constexpr align operator| (vertical_align first, horizontal_align second)
 You can use the | operator to create an align from a horizontal_align and a vertical_align.
 
constexpr const charto_name (horizontal_align h)
 Get alignment name.
 
constexpr const charto_name (vertical_align v)
 Get alignment name.
 
constexpr const charto_name (align a)
 Get alignment name.
 
constexpr const charto_natural_name (align a)
 Get natural alignment name.
 
constexpr vertical_align to_vertical (horizontal_align alignment)
 Returns alignment as if it was on a vertical line.
 
constexpr vertical_align to_vertical (vertical_align alignment)
 Returns alignment as if it was on a vertical line.
 
constexpr horizontal_align to_horizontal (vertical_align alignment)
 Returns alignment as if it was on a horizontal line.
 
constexpr horizontal_align to_horizontal (horizontal_align alignment)
 Returns alignment as if it was on a horizontal line.
 
constexpr vertical_align vertical_from (align alignment)
 Gets just the vertical component from the align (as a vertical_align)
 
constexpr horizontal_align horizontal_from (align alignment)
 Gets just the horizontal component from the align (as a horizontal_align)
 
constexpr align only_vertical (align alignment)
 Gets a mew align that only has the vertical component.
 
constexpr align only_horizontal (align alignment)
 Gets a mew align that only has the horizontal component.
 
constexpr vertical_align to_opposite (vertical_align alignment)
 Returns the opposite aligment.
 
constexpr horizontal_align to_opposite (horizontal_align alignment)
 Returns the opposite aligment.
 
constexpr align to_opposite (align alignment)
 Gets an align that is opposite on bost axes.
 
constexpr align rotated_clockwise (align alignment)
 Returns the 2D alignment rotated clockwise.
 
constexpr align rotated_counter_clockwise (align alignment)
 Like rotated_clockwise but counter clockwise.
 
constexpr align flipped_horizontally (align alignment)
 
constexpr align flipped_vertically (align alignment)
 
template<typename T >
constexpraligned (const T &width, const T &max_width, horizontal_align align)
 
template<typename T >
constexpraligned (const T &width, const T &max_width, vertical_align align)
 
enum class  color_space { linear_rgba , srgb , hsva , rgbe }
 Implementation note: These functions use the .xyzw members instead of the .rgba members because accessing the latter is not constexpr. More...
 
using color_rgba_t = glm::vec4
 Represents a color in RGBA color space, with 0.0-1.0 float elements.
 
using color_hsva_t = named< glm::vec4, "color_hsva">
 Represents a color in HSVA color space, with H=0.0-6.0, S=0.0-1.0, V=0.0-1.0, A=0.0-1.0 float elements.
 
using color_t = color_rgba_t
 Default color_t type is RGBA.
 
using color_rgba_u32_t = named< uint32_t, "color_rgba_u32">
 Represent a packed RGBA color with 8 bits per pixel.
 
using color_abgr_u32_t = named< uint32_t, "color_abgr_u32">
 Represent a packed ABGR color with 8 bits per pixel.
 
constexpr color_t premultiplied (color_t const &color)
 Returns the color multiplied by its own alpha.
 
constexpr color_t saturated (color_t const &color)
 Returns a color with all elements clamped between 0 and 1.
 
constexpr color_t lighten (color_t const &color, float coef)
 Returns a color lightened by a coefficient.
 
constexpr color_t contrast (color_t const &color, float contrast)
 Returns a color with its contrast changed.
 
constexpr color_t contrast2 (color_t const &color, float contrast)
 Returns a color with its contrast changed This uses a differen algorithm and contrast value than contrast.
 
constexpr color_t gamma_correct (color_t const &color, const float gamma)
 Returns a gamma corrected color.
 
constexpr color_t inverted (color_t const &color)
 Returns an inverted color, i.e. with (1.0-x) on all of its elements, excluding its alpha.
 
constexpr color_t contrasting (color_t const &color)
 Returns a color that's a good contrasting color for the original.
 
constexpr float luminance (color_t const &color)
 Get brightness of color.
 
constexpr color_t desaturated (color_t const &color, float desaturation)
 Returns a color sapped of desaturation percent (0-1) of its saturation.
 
constexpr color_t from_u32_rgb (uint32_t rgb)
 Gets a color from an RGB 8bpp integer, with R being most significant.
 
constexpr color_t from_u32_bgr (uint32_t rgb)
 Gets a color from an BGR 8bpp integer, with R being least significant.
 
constexpr color_t from_u32_rgba (uint32_t rgb)
 Gets a color from an RGBA 8bpp integer, with R being most significant.
 
constexpr color_t from_u32_bgra (uint32_t rgb)
 Gets a color from an BGRA 8bpp integer, with A being least significant, and B being most significant.
 
constexpr color_t from_u32_argb (uint32_t rgb)
 Gets a color from an ARGB 8bpp integer, with A being most significant, and B being least significant.
 
constexpr color_t from_u32_abgr (uint32_t rgb)
 Gets a color from an ABGR 8bpp integer, with A being most significant, and R being least significant.
 
constexpr uint32_t to_u32_argb (color_t const &rgba)
 Creates an 8bpp ARGB integer from a color.
 
constexpr uint32_t to_u32_abgr (color_t const &rgba)
 Creates an 8bpp ABGR integer from a color.
 
constexpr uint32_t to_u32_rgba (color_t const &rgba)
 Creates an 8bpp RGBA integer from a color.
 
constexpr uint32_t to_u32_bgra (color_t const &rgba)
 Creates an 8bpp BGRA integer from a color.
 
constexpr uint32_t to_u32_rgb (color_t const &rgba)
 Creates a 32 bitbpp RGB integer from a color, with the most significant 8 bits set to 0.
 
constexpr uint32_t to_u32_bgr (color_t const &rgba)
 Creates a 32 bitbpp BGR integer from a color, with the most significant 8 bits set to 0.
 
template<std::same_as< color_rgba_u32_t > TO>
constexpr TO named_cast (color_rgba_t const &from)
 
template<typename TO , typename FROM >
TO color_cast (FROM const &from)
 
constexpr glm::tvec4< uint8_tto_u8 (color_t const &rgba)
 Returns the color as a glm::vec4 of uint8_ts.
 
constexpr color_t to_rgb (color_hsva_t const &hsva)
 Converts a HSVA color to RGBA space.
 
constexpr color_hsva_t to_hsv (color_t const &rgba)
 Converts an RGBA color to HSVA space.
 
constexpr color_rgba_t from_html (const char *str, size_t n)
 Converts a HTML color string (like #FBA or fafafa) to an RGBA color.
 
consteval color_rgba_t operator""_rgb (const char *str, size_t n)
 Converts a HTML color string (like #FBA or fafafa) to an RGBA color.
 
constexpr color_rgba_t from_html (std::string_view html)
 Converts a HTML color string (like #FBA or fafafa) to an RGBA color.
 
template<typename BUFFER >
using buffer_element_type = typename decltype(detail::deduce_buffer_element_type< BUFFER >())::type
 
template<typename BUFFER , typename T >
bool buffer_append (BUFFER &&buffer, T &&val)
 Primary function to append a value (preferably the buffer element type) to the buffer.
 
template<typename BUFFER >
bool buffer_reserve (BUFFER &buffer, size_t additional)
 Reserves additional elements in the buffer, if possible.
 
template<typename BUFFER , typename RANGE >
requires output_buffer<BUFFER, std::ranges::range_value_t<RANGE>>
size_t buffer_append_range (BUFFER &buffer, RANGE &&range)
 Appends elements in the range to the buffer
 
template<typename BUFFER , typename CHAR_TYPE >
requires output_buffer<BUFFER, CHAR_TYPE>
size_t buffer_append_cstring_ptr (BUFFER &buffer, const CHAR_TYPE *cstr)
 Appends characters in the cstr to the buffer
 
template<typename BUFFER , typename CHAR_TYPE >
requires output_buffer<BUFFER, CHAR_TYPE>
size_t buffer_append_cstring_ptr (BUFFER &buffer, const CHAR_TYPE *cstr, size_t max_len)
 Appends at most max_len characters in the cstr to the buffer
 
template<typename BUFFER , size_t N, typename CHAR_TYPE >
requires output_buffer<BUFFER, CHAR_TYPE>
size_t buffer_append_cstring (BUFFER &buffer, const CHAR_TYPE(&cstr)[N])
 Appends characters in the cstr literal array to the buffer
 
template<typename BUFFER , typename ELEMENT_TYPE = buffer_element_type<BUFFER>>
requires output_buffer<BUFFER, ELEMENT_TYPE>
size_t buffer_append_utf8 (BUFFER &buffer, char32_t cp)
 Appends UTF-8 codeunits that represent the Unicode code-point cp to the buffer. Assumes the codepoint is a valid Unicode codepoint that represents a character.
 
template<typename BUFFER , typename STRING_TYPE , typename ELEMENT_TYPE = buffer_element_type<BUFFER>>
requires output_buffer<BUFFER, ELEMENT_TYPE> && std::ranges::range<STRING_TYPE> && std::same_as<std::ranges::range_value_t<STRING_TYPE>, char32_t>
size_t buffer_append_utf8 (BUFFER &buffer, STRING_TYPE &&str)
 Appends UTF-8 codeunits that represent the UTF-32 range str to the buffer.
 
template<typename BUFFER , typename POD >
requires std::is_trivially_copyable_v<POD> && bytelike<buffer_element_type<BUFFER>>
size_t buffer_append_pod (BUFFER &buffer, POD const &pod)
 Appends a POD values internal object representation to a buffer.
 
template<typename BUFFER , typename CALLBACK >
requires std::invocable<CALLBACK, size_t, std::string_view, BUFFER&>
void callback_format_to (BUFFER &buffer, std::string_view fmt, CALLBACK &&callback)
 TODO: Make this work - currently needs string_ops
 
template<typename RANGE >
using 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 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 contains
 contains(range, el)
 
constexpr __contains_subrange_fn contains_subrange
 contains_subrange(range, subrange)
 
constexpr bool 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 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 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(autoat (random_access_range auto &range, std::integral auto index)
 Returns a reference to the value at index of range
 
constexpr auto 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(automodulo_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 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 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 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 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 find_if_or_default (RANGE &range, FUNC &&func, DEF_TYPE &&default_value=DEF_TYPE{})
 
constexpr auto 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 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 > > 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 > 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 * > as_range (std::span< T, N > span)
 
template<typename TO , typename FROM , size_t N = std::dynamic_extent>
auto 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 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 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 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 starts_with (std::span< T, N1 > s1, std::span< U, N2 > s2)
 
template<typename T , std::size_t... Ns>
constexpr auto 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 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 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 to (RANGE &&_Range, TYPES &&... ARGS)
 to<container>();
 

Detailed Description

Primary namespace for everything in this library.

DEPRECATED: Use the moal library instead of this functionality.

Manipulators All of these are pretty much stolen from Daisy Hollman (https://twitter.com/the_whole_daisy), her twitter is fantastic.

WIP WIP WIP WIP.

An extension to the glm library. Adds a class template that represents a 2D axis-aligned rectangle.

TODO: https://www.remi-coulom.fr/joedb/checkpoints.html.

Only for CHAR_BIT, sigh.

TODO: std::bitset is constexpr since C++23, so we can internally use that as soon as support for C++23 is widespread enough For example, we could have a version of enum_flags that takes an ENUM MIN_VALUE and an ENUM MAX_VALUE template parameters, and uses those to create a std::bitset<MAX_VALUE - MIN_VALUE + 1> internally, and then use that to store the bits.


Class Documentation

◆ ghassanpl::get_index

struct ghassanpl::get_index
template<typename T, typename>
struct ghassanpl::get_index< T, typename >

std::variant get index of type

Definition at line 193 of file templates.h.

Typedef Documentation

◆ copy_const_t

template<typename S , typename D >
using ghassanpl::copy_const_t = typedef std::conditional_t<std::is_const_v<S>, std::add_const_t<D>, std::remove_const_t<D> >

Definition at line 47 of file bytes.h.

◆ default_symbol_provider

using ghassanpl::default_symbol_provider = typedef default_symbol_provider_t<void>

Definition at line 120 of file symbol.h.

◆ file_handle_type

using ghassanpl::file_handle_type = typedef int

Definition at line 73 of file mmap.h.

◆ first_type_of

template<typename... Ts>
using ghassanpl::first_type_of = typedef std::tuple_element_t<0, std::tuple<Ts...> >

Definition at line 25 of file templates.h.

◆ last_type_of

template<typename... Ts>
using ghassanpl::last_type_of = typedef std::tuple_element_t<(sizeof...(Ts) - 1), std::tuple<Ts...> >

Definition at line 27 of file templates.h.

◆ nth_type_of

template<size_t I, typename... Ts>
using ghassanpl::nth_type_of = typedef std::tuple_element_t<I, std::tuple<Ts...> >

Definition at line 23 of file templates.h.

◆ optional_scoped_value_change

◆ remove_cvref_t

template<class T >
using ghassanpl::remove_cvref_t = typedef std::remove_cv_t<std::remove_reference_t<T> >

Definition at line 18 of file cpp20.h.

◆ symbol

using ghassanpl::symbol = typedef symbol_base<default_symbol_provider>

Definition at line 121 of file symbol.h.

Enumeration Type Documentation

◆ enum_flag_change

enum class ghassanpl::enum_flag_change : uint8_t
strong

Definition at line 339 of file enum_flags.h.

Function Documentation

◆ align_back_to()

template<size_t ALIGN, bytelike T, size_t N = std::dynamic_extent>
constexpr auto ghassanpl::align_back_to ( std::span< T, N bytes) -> align_back_to_result<T>
constexprnoexcept

Splits the argument span into two spans, the first one having its size aligned to the given alignment, the second one being the suffix.

Assumes/expects bytes.data() is aligned to the specified alignment.

Definition at line 191 of file bytes.h.

◆ align_front_to()

template<size_t ALIGN, bytelike T, size_t N = std::dynamic_extent>
auto ghassanpl::align_front_to ( std::span< T, N bytes) -> align_front_to_result<T>
noexcept

Splits the argument span into two spans, the first one being the prefix, the second one having its data pointer aligned to the given alignment.

Definition at line 162 of file bytes.h.

◆ align_to()

template<size_t ALIGN, bytelike T, size_t N = std::dynamic_extent>
auto ghassanpl::align_to ( std::span< T, N bytes) -> align_to_result<T>
noexcept

Splits the argument span into three spans, the first one being the prefix, the second one having its data and size aligned to the given alignment, the third one being the suffix.

Definition at line 221 of file bytes.h.

◆ aligned() [1/2]

template<typename T >
constexpr trec2< T > ghassanpl::aligned ( glm::tvec2< T >  inner_size,
trec2< T > const larger,
align  alignment 
)
constexpr

Definition at line 24 of file align+rec2.h.

◆ aligned() [2/2]

template<typename T >
constexpr trec2< T > ghassanpl::aligned ( trec2< T > const smaller,
trec2< T > const larger,
align  alignment 
)
constexpr

Definition at line 12 of file align+rec2.h.

◆ aligned_span_cast()

template<typename TO , bytelike B, size_t N = std::dynamic_extent>
auto ghassanpl::aligned_span_cast ( std::span< B, N bytes) -> align_to_result<B, TO>
noexcept

Definition at line 246 of file bytes.h.

◆ aligned_span_cast_and_construct()

template<typename TO , bytelike B, size_t N = std::dynamic_extent>
auto ghassanpl::aligned_span_cast_and_construct ( std::span< B, N bytes) -> align_to_result<B, TO>
noexcept

Definition at line 257 of file bytes.h.

◆ apply_to_nth() [1/2]

template<size_t N, typename FUNC , typename... ARGS>
requires (N < sizeof...(ARGS))
constexpr auto ghassanpl::apply_to_nth ( FUNC &&  f,
ARGS &&...  args 
)
constexpr

Function: apply_to_nth Calls f on the Nth argument in the args pack.

Definition at line 500 of file templates.h.

◆ apply_to_nth() [2/2]

template<size_t I, typename FUNC , typename... ARGS>
requires (I < sizeof...(ARGS))
constexpr auto ghassanpl::apply_to_nth ( FUNC &&  f,
ARGS &&...  args 
)
constexpr

Function: apply_to_nth Calls f on the Nth argument in the args pack.

Definition at line 500 of file templates.h.

◆ apply_to_slice() [1/3]

template<size_t Begin, size_t End, size_t Stride, double & ..., typename FUNC , typename... ARGS>
constexpr auto ghassanpl::apply_to_slice ( FUNC &&  f,
ARGS &&...  args 
)
constexpr

Function: apply_to_slice Calls f with a slice of the args pack.

The slice will start at Begin, end at End, and increment by Stride arguments.

Definition at line 542 of file templates.h.

◆ apply_to_slice() [2/3]

template<size_t Begin, size_t End, double & ..., typename FUNC , typename... ARGS>
constexpr auto ghassanpl::apply_to_slice ( FUNC &&  f,
ARGS &&...  args 
)
constexpr

Function: apply_to_slice Calls f with a slice of the args pack.

The slice will start at Begin, end at End, and increment by 1 argument.

Definition at line 548 of file templates.h.

◆ apply_to_slice() [3/3]

template<size_t Begin, double & ..., typename FUNC , typename... ARGS>
constexpr auto ghassanpl::apply_to_slice ( FUNC &&  f,
ARGS &&...  args 
)
constexpr

Function: apply_to_slice Calls f with a slice of the args pack.

The slice will start at Begin, and increment by 1 argument.

Definition at line 554 of file templates.h.

◆ as() [1/11]

template<typename C >
auto ghassanpl::as (   ...) -> auto

Definition at line 142 of file templates.h.

◆ as() [2/11]

template<typename T , typename... Ts>
auto ghassanpl::as ( std::variant< Ts... > const x)

Definition at line 246 of file templates.h.

◆ as() [3/11]

template<typename C , typename X >
requires std::is_base_of_v<C, X>
auto ghassanpl::as ( X &&  x) -> C&&

Definition at line 161 of file templates.h.

◆ as() [4/11]

template<typename C , typename X >
requires (std::is_base_of_v<X, C> && !std::is_same_v<C, X>)
auto ghassanpl::as ( X &  x) -> C&

Definition at line 167 of file templates.h.

◆ as() [5/11]

template<typename C , typename X >
requires (std::is_base_of_v<X, C> && !std::is_same_v<C, X>)
auto ghassanpl::as ( X *  x) -> C*

Definition at line 179 of file templates.h.

◆ as() [6/11]

template<typename C , typename X >
requires (!std::is_same_v<C, X> && std::constructible_from<C, X const&>)
auto ghassanpl::as ( X const x) -> auto

Definition at line 153 of file templates.h.

◆ as() [7/11]

template<typename C , typename X >
requires std::is_same_v<C, X>
auto ghassanpl::as ( X const x) -> auto&&

Definition at line 148 of file templates.h.

◆ as() [8/11]

template<typename T , typename X >
requires std::is_same_v<X, std::optional<T>>
constexpr auto ghassanpl::as ( X const x) -> auto&&
constexpr

Definition at line 295 of file templates.h.

◆ as() [9/11]

template<typename C , typename X >
requires (std::is_base_of_v<X, C> && !std::is_same_v<C, X>)
auto ghassanpl::as ( X const x) -> C const&

Definition at line 173 of file templates.h.

◆ as() [10/11]

template<typename T , typename X >
requires (!std::is_reference_v<T> && std::is_same_v<X, std::any> && !std::is_same_v<T, std::any>)
constexpr auto ghassanpl::as ( X const x) -> T
constexpr

Definition at line 270 of file templates.h.

◆ as() [11/11]

template<typename C , typename X >
requires (std::is_base_of_v<X, C> && !std::is_same_v<C, X>)
auto ghassanpl::as ( X const x) -> C const*

Definition at line 185 of file templates.h.

◆ as_bytelikes() [1/2]

template<bytelike TO, typename FROM , size_t N = std::dynamic_extent>
requires std::is_trivially_copyable_v<FROM>
std::span< TO > ghassanpl::as_bytelikes ( std::span< FROM, N bytes)
noexcept

Converts a span of trivial values to a span of bytelike s.

Definition at line 27 of file bytes.h.

◆ as_bytelikes() [2/2]

template<bytelike TO, typename T >
requires std::is_trivially_copyable_v<T>
std::span< TO const > ghassanpl::as_bytelikes ( T const pod)
noexcept

Returns a span of bytelike s that represents the internal object representation of the argument.

Definition at line 35 of file bytes.h.

◆ as_bytes() [1/2]

template<bytelike FROM, size_t N = std::dynamic_extent>
auto ghassanpl::as_bytes ( std::span< FROM, N bytes)
noexcept

Definition at line 50 of file bytes.h.

◆ as_bytes() [2/2]

template<typename T >
requires std::is_trivial_v<T>
auto ghassanpl::as_bytes ( T const data)
noexcept

Definition at line 56 of file bytes.h.

◆ as_char8s() [1/2]

template<bytelike FROM, size_t N = std::dynamic_extent>
auto ghassanpl::as_char8s ( std::span< FROM, N bytes)
noexcept

Definition at line 53 of file bytes.h.

◆ as_char8s() [2/2]

template<typename T >
requires std::is_trivial_v<T>
auto ghassanpl::as_char8s ( T const data)
noexcept

Definition at line 59 of file bytes.h.

◆ as_chars() [1/2]

template<bytelike FROM, size_t N = std::dynamic_extent>
auto ghassanpl::as_chars ( std::span< FROM, N bytes)
noexcept

Definition at line 49 of file bytes.h.

◆ as_chars() [2/2]

template<typename T >
requires std::is_trivial_v<T>
auto ghassanpl::as_chars ( T const data)
noexcept

Definition at line 55 of file bytes.h.

◆ as_u8s() [1/2]

template<bytelike FROM, size_t N = std::dynamic_extent>
auto ghassanpl::as_u8s ( std::span< FROM, N bytes)
noexcept

Definition at line 52 of file bytes.h.

◆ as_u8s() [2/2]

template<typename T >
requires std::is_trivial_v<T>
auto ghassanpl::as_u8s ( T const data)
noexcept

Definition at line 58 of file bytes.h.

◆ as_uchars() [1/2]

template<bytelike FROM, size_t N = std::dynamic_extent>
auto ghassanpl::as_uchars ( std::span< FROM, N bytes)
noexcept

Definition at line 51 of file bytes.h.

◆ as_uchars() [2/2]

template<typename T >
requires std::is_trivial_v<T>
auto ghassanpl::as_uchars ( T const data)
noexcept

Definition at line 57 of file bytes.h.

◆ byteswap()

template<class T , std::enable_if_t< std::is_integral_v< T >, int > = 0>
constexpr T ghassanpl::byteswap ( const val)
constexprnoexcept

Definition at line 82 of file cpp23.h.

◆ byteswap_uint64()

constexpr unsigned long long ghassanpl::byteswap_uint64 ( const unsigned long long  val)
constexprnoexcept

Definition at line 75 of file cpp23.h.

◆ byteswap_ulong()

constexpr unsigned long ghassanpl::byteswap_ulong ( const unsigned long  val)
constexprnoexcept

Definition at line 71 of file cpp23.h.

◆ byteswap_ushort()

constexpr unsigned short ghassanpl::byteswap_ushort ( const unsigned short  val)
constexprnoexcept

Definition at line 67 of file cpp23.h.

◆ call_with_expected_ec()

template<typename FUNC , typename... ARGS>
auto ghassanpl::call_with_expected_ec ( FUNC &&  func,
ARGS &&...  args 
) -> expected<std::invoke_result_t<FUNC, ARGS&&...>, std::error_code>
inlinenoexcept

Calls the given function with args and an std::error_code as the last argument.

Returns
an expected with the result of the function call if the std::error_code is 0, otherwise an unexpected with the error code

Definition at line 38 of file expected.h.

◆ ce_hash64() [1/4]

template<typename FIRST , typename... T>
requires (sizeof...(T) > 0)
consteval uint64_t ghassanpl::ce_hash64 ( FIRST const first,
T const &...  values 
)

Definition at line 280 of file hashes.h.

◆ ce_hash64() [2/4]

template<bytelike T>
consteval uint64_t ghassanpl::ce_hash64 ( std::basic_string_view< T > const val)
noexcept

Definition at line 276 of file hashes.h.

◆ ce_hash64() [3/4]

template<typename... T>
consteval uint64_t ghassanpl::ce_hash64 ( std::tuple< T... > const tupl)
noexcept

Definition at line 294 of file hashes.h.

◆ ce_hash64() [4/4]

template<typename T >
requires (sizeof(T) <= sizeof(uint64_t)) && ((sizeof(T) & (sizeof(T) - 1)) == 0) && std::is_trivially_copyable_v<T>
consteval uint64_t ghassanpl::ce_hash64 ( val)
noexcept

Definition at line 263 of file hashes.h.

◆ ce_hash64_tuple_elements()

template<typename TUPLE_TYPE , uint64_t... Is>
consteval void ghassanpl::ce_hash64_tuple_elements ( uint64_t hash,
TUPLE_TYPE const t,
std::index_sequence< Is... >   
)

Definition at line 288 of file hashes.h.

◆ compose_uri()

uri_expected< uri > ghassanpl::compose_uri ( decomposed_uri const decomposed,
enum_flags< uri_decompose_flags > const  flags 
)

Definition at line 293 of file uri_impl.h.

◆ DefaultReportAssumptionFailure()

void ghassanpl::DefaultReportAssumptionFailure ( std::string_view  expectation,
std::initializer_list< std::pair< std::string_view, std::string > >  values,
std::string  data,
source_location  loc 
)
inline

Definition at line 317 of file assuming.h.

◆ eat_from_string()

template<typename T >
bool ghassanpl::eat_from_string ( std::string_view &  from,
T &&  val 
)

Definition at line 53 of file stringification.h.

◆ enumerate_pack()

template<typename FUNC , typename... ARGS>
constexpr void ghassanpl::enumerate_pack ( FUNC &&  f,
ARGS &&...  args 
)
constexpr

Function: enumerate_pack Calls f on every argument args....

f must take one or two arguments: either a single argument for each element of the pack, or a size_t index of the argument, and then the argument.

Definition at line 473 of file templates.h.

◆ first_value_of()

template<typename... Ts>
auto ghassanpl::first_value_of ( Ts &&...  args)

Definition at line 42 of file templates.h.

◆ flag_bit()

EF_CONSTEXPR RESULT_TYPE ghassanpl::flag_bit ( ENUM_TYPE  e)

Definition at line 22 of file enum_flags.h.

◆ fold_in_hash64()

constexpr void ghassanpl::fold_in_hash64 ( uint64_t hash1,
uint64_t  hash2 
)
constexprnoexcept

Definition at line 246 of file hashes.h.

◆ for_each()

template<typename... ARGS, typename FUNC >
constexpr void ghassanpl::for_each ( FUNC &&  f)
constexpr

Function: for_each TODO: Description.

Definition at line 449 of file templates.h.

◆ for_each_in_tuple() [1/2]

template<typename... ARGS, typename FUNC >
constexpr void ghassanpl::for_each_in_tuple ( std::tuple< ARGS... > &&  t,
FUNC &&  f 
)
constexpr

Definition at line 461 of file templates.h.

◆ for_each_in_tuple() [2/2]

template<typename... ARGS, typename FUNC >
constexpr void ghassanpl::for_each_in_tuple ( std::tuple< ARGS... > const t,
FUNC &&  f 
)
constexpr

Function: for_each_in_tuple.

Definition at line 455 of file templates.h.

◆ for_each_pair()

template<typename FUNC , typename... ARGS>
requires ((sizeof...(ARGS) % 2) == 0)
constexpr void ghassanpl::for_each_pair ( FUNC &&  f,
ARGS &&...  args 
)
constexpr

Function: for_each_pair TODO: Description.

Definition at line 325 of file templates.h.

◆ forward_like()

template<class Ty , class Uty >
constexpr auto && ghassanpl::forward_like ( Uty &&  Ux)
constexprnoexcept

Definition at line 38 of file cpp23.h.

◆ from_string() [1/2]

template<typename T , template< bool > typename STRINGIFIER = string_stringifier>
requires requires (STRINGIFIER<false> str, T val) { stringify(str, val); }
T ghassanpl::from_string ( std::string_view  val)

Definition at line 126 of file stringification.h.

◆ from_string() [2/2]

template<typename T , template< bool > typename STRINGIFIER = string_stringifier>
requires requires (STRINGIFIER<false> str, T val) { stringify(str, val); }
bool ghassanpl::from_string ( std::string_view  val,
T &  target 
)

Definition at line 116 of file stringification.h.

◆ get_last_windows_error()

last_windows_error_t ghassanpl::get_last_windows_error ( )

Definition at line 30 of file last_error.h.

◆ hash64()

template<template< typename > typename HASHER = std::hash, typename FIRST , typename... T>
constexpr uint64_t ghassanpl::hash64 ( FIRST &&  first,
T &&...  values 
)
constexpr

Definition at line 315 of file hashes.h.

◆ interpolate_eval()

template<bool SYNTAX>
std::string ghassanpl::interpolate_eval ( std::string_view  str,
eval::environment< SYNTAX > &  env 
)

Definition at line 34 of file string_interpolate.h.

◆ interpolate_simple()

template<typename FUNC >
std::string ghassanpl::interpolate_simple ( std::string_view  str,
FUNC &&  func 
)

Definition at line 14 of file string_interpolate.h.

◆ is() [1/11]

template<typename T , typename U >
requires std::is_same_v<T, void>
constexpr auto ghassanpl::is ( std::optional< U > const x) -> bool
constexpr

Definition at line 288 of file templates.h.

◆ is() [2/11]

template<typename T , typename... Ts>
auto ghassanpl::is ( std::variant< Ts... > const x)

Definition at line 234 of file templates.h.

◆ is() [3/11]

template<typename C , typename X >
auto ghassanpl::is ( X const ) -> bool

Shamelessly stolen from hsutter's cppfront.

Definition at line 106 of file templates.h.

◆ is() [4/11]

template<typename C , typename X >
requires std::is_same_v<C, X>
auto ghassanpl::is ( X const ) -> bool

Definition at line 112 of file templates.h.

◆ is() [5/11]

template<typename C , typename X >
requires (std::is_base_of_v<C, X> && !std::is_same_v<C, X>)
auto ghassanpl::is ( X const ) -> bool

Definition at line 118 of file templates.h.

◆ is() [6/11]

template<typename C , typename X >
requires (std::is_base_of_v<X, C> && !std::is_same_v<C, X>)
auto ghassanpl::is ( X const x) -> bool

Definition at line 124 of file templates.h.

◆ is() [7/11]

template<typename C , typename X >
requires dereferenceable<X> && std::is_default_constructible_v<X> && std::is_same_v<C, void>
auto ghassanpl::is ( X const x) -> bool

Definition at line 136 of file templates.h.

◆ is() [8/11]

template<typename T , typename X >
requires (std::is_same_v<X, std::any> && !std::is_same_v<T, std::any> && !std::is_same_v<T, void>)
constexpr auto ghassanpl::is ( X const x) -> bool
constexpr

Definition at line 256 of file templates.h.

◆ is() [9/11]

template<typename T , typename X >
requires (std::is_same_v<X, std::any> && std::is_same_v<T, void>)
constexpr auto ghassanpl::is ( X const x) -> bool
constexpr

Definition at line 263 of file templates.h.

◆ is() [10/11]

template<typename T , typename X >
requires std::is_same_v<X, std::optional<T>>
constexpr auto ghassanpl::is ( X const x) -> bool
constexpr

Definition at line 281 of file templates.h.

◆ is() [11/11]

template<typename C , typename X >
requires (std::is_base_of_v<X, C> && !std::is_same_v<C, X>)
auto ghassanpl::is ( X const x) -> bool

Definition at line 130 of file templates.h.

◆ last_value_of()

template<typename... Ts>
auto ghassanpl::last_value_of ( Ts &&...  args)

Definition at line 49 of file templates.h.

◆ lerp()

template<typename ALPHA , typename T , detail::FixedString PARAMETER, typename... TRAITS>
auto ghassanpl::lerp ( named< T, PARAMETER, TRAITS... > const value_a,
named< T, PARAMETER, TRAITS... > const value_b,
ALPHA &&  alpha 
)

Definition at line 306 of file named.h.

◆ make_optional()

template<class T , class... TYPES, std::enable_if_t< std::is_constructible_v< T, TYPES... >, int > = 0>
constexpr sentinel_optional< T > ghassanpl::make_optional ( TYPES &&...  args)
constexprnoexcept

Definition at line 239 of file soptional.h.

◆ make_sentinel_optional()

template<class T , std::enable_if_t< std::is_constructible_v< std::decay_t< T >, T >, int > = 0>
constexpr sentinel_optional< std::decay_t< T > > ghassanpl::make_sentinel_optional ( T &&  value)
constexprnoexcept

Definition at line 234 of file soptional.h.

◆ nth_bit() [1/4]

template<bytelike B, size_t N = std::dynamic_extent>
bool ghassanpl::nth_bit ( std::span< B const, N range,
size_t  n 
)
noexcept

Definition at line 63 of file bytes.h.

◆ nth_bit() [2/4]

template<size_t N, bytelike B, size_t SN = std::dynamic_extent>
bool ghassanpl::nth_bit ( std::span< B const, SN range)
noexcept

Definition at line 100 of file bytes.h.

◆ nth_bit() [3/4]

template<size_t N, typename T >
requires std::is_trivially_copyable_v<T>
bool ghassanpl::nth_bit ( T const pod)
noexcept

Definition at line 124 of file bytes.h.

◆ nth_bit() [4/4]

template<typename T >
requires std::is_trivially_copyable_v<T>
bool ghassanpl::nth_bit ( T const pod,
size_t  n 
)
noexcept

Definition at line 87 of file bytes.h.

◆ nth_value_of()

template<size_t I, typename T , typename... Ts>
auto ghassanpl::nth_value_of ( T &&  t,
Ts &&...  args 
)

Definition at line 30 of file templates.h.

◆ operator+()

template<typename T >
trec2< T > ghassanpl::operator+ ( glm::tvec2< T >  op,
trec2< T >  rec 
)
noexcept

Definition at line 316 of file rec2.h.

◆ operator==()

template<class T >
constexpr bool ghassanpl::operator== ( const sentinel_optional< T > &  left,
std::nullopt_t   
)
constexprnoexcept

Definition at line 231 of file soptional.h.

◆ protected_copy()

template<mutex_type MUTEX_TYPE, typename T >
auto ghassanpl::protected_copy ( MUTEX_TYPE m,
T &&  t 
)

Definition at line 30 of file threading.h.

◆ ReportAssumptionFailure()

void ghassanpl::ReportAssumptionFailure ( std::string_view  expectation,
std::initializer_list< std::pair< std::string_view, std::string > >  values,
std::string  data,
source_location  loc = source_location::current() 
)
inline

Definition at line 338 of file assuming.h.

◆ set_nth_bit() [1/4]

template<bytelike B, size_t N = std::dynamic_extent>
void ghassanpl::set_nth_bit ( std::span< B, N range,
size_t  n,
bool  value 
)
noexcept

Definition at line 73 of file bytes.h.

◆ set_nth_bit() [2/4]

template<size_t N, bytelike B, size_t SN = std::dynamic_extent>
void ghassanpl::set_nth_bit ( std::span< B, SN range,
bool  value 
)
noexcept

Definition at line 110 of file bytes.h.

◆ set_nth_bit() [3/4]

template<size_t N, typename T >
requires std::is_trivially_copyable_v<T>
void ghassanpl::set_nth_bit ( T &  pod,
bool  value 
)
noexcept

Definition at line 131 of file bytes.h.

◆ set_nth_bit() [4/4]

template<typename T >
requires std::is_trivially_copyable_v<T>
void ghassanpl::set_nth_bit ( T &  pod,
size_t  n,
bool  value 
)
noexcept

Definition at line 94 of file bytes.h.

◆ stringify() [1/4]

template<typename STRINGIFIER >
auto ghassanpl::stringify ( STRINGIFIER str,
const source_location &  b 
)

Definition at line 63 of file source_location.h.

◆ stringify() [2/4]

template<typename T , detail::FixedString PARAMETER, typename STRINGIFIER >
auto ghassanpl::stringify ( STRINGIFIER str,
named< T, PARAMETER > const val 
)

Definition at line 300 of file named.h.

◆ stringify() [3/4]

template<typename T , typename STRINGIFIER >
auto ghassanpl::stringify ( STRINGIFIER str,
trec2< T > &  b 
)

Definition at line 319 of file rec2.h.

◆ stringify() [4/4]

template<typename T , typename STRINGIFIER >
auto ghassanpl::stringify ( STRINGIFIER str,
trec2< T > const b 
)

Definition at line 321 of file rec2.h.

◆ to_byte()

template<bytelike FROM>
constexpr auto ghassanpl::to_byte ( FROM  byte)
constexprnoexcept

Definition at line 42 of file bytes.h.

◆ to_bytelike_array()

template<bytelike B, std::integral T>
constexpr auto ghassanpl::to_bytelike_array ( value)
constexpr

A constexpr function that converts an integral value to its constituent bytelikes TODO: This is NOT like a reinterpret_/bit_cast to u8s, because it's not endian-aware.

Definition at line 139 of file bytes.h.

◆ to_char()

template<bytelike FROM>
constexpr auto ghassanpl::to_char ( FROM  byte)
constexprnoexcept

Definition at line 41 of file bytes.h.

◆ to_char8()

template<bytelike FROM>
constexpr auto ghassanpl::to_char8 ( FROM  byte)
constexprnoexcept

Definition at line 44 of file bytes.h.

◆ to_string() [1/5]

std::string ghassanpl::to_string ( nullptr_t  )
inline

Definition at line 27 of file stringification.h.

◆ to_string() [2/5]

template<typename T >
requires std::constructible_from<std::string_view, T>
std::string ghassanpl::to_string ( T &&  val)

Definition at line 26 of file stringification.h.

◆ to_string() [3/5]

template<typename T , template< bool > typename STRINGIFIER = string_stringifier>
requires requires (STRINGIFIER<true> str, T val) { stringify(str, val); }
std::string ghassanpl::to_string ( T &&  val)

Definition at line 106 of file stringification.h.

◆ to_string() [4/5]

template<std::same_as< char > T>
std::string ghassanpl::to_string ( c)

Definition at line 12 of file stringification.h.

◆ to_string() [5/5]

template<typename T >
requires (!std::same_as<T, char> && std::integral<T>)
std::string ghassanpl::to_string ( val)

Definition at line 15 of file stringification.h.

◆ to_u8()

template<bytelike FROM>
constexpr auto ghassanpl::to_u8 ( FROM  byte)
constexprnoexcept

Definition at line 40 of file bytes.h.

◆ to_u8_array()

template<std::integral T>
constexpr auto ghassanpl::to_u8_array ( value)
constexpr

Definition at line 151 of file bytes.h.

◆ to_uchar()

template<bytelike FROM>
constexpr auto ghassanpl::to_uchar ( FROM  byte)
constexprnoexcept

Definition at line 43 of file bytes.h.

◆ transform()

template<typename T , typename FUNC >
auto ghassanpl::transform ( std::optional< T > const value,
FUNC &&  func 
) -> decltype(std::optional{ func(value.value()) })

Definition at line 153 of file functional.h.

◆ transform_tuple()

template<typename... ARGS, typename FUNC >
constexpr auto ghassanpl::transform_tuple ( std::tuple< ARGS... > const t,
FUNC &&  f 
)
constexpr

Function: transform_tuple.

Definition at line 467 of file templates.h.

◆ under_protection()

template<mutex_type MUTEX_TYPE, typename FUNC , typename... ARGS>
auto ghassanpl::under_protection ( MUTEX_TYPE m,
FUNC &&  func,
ARGS &&...  args 
)

Definition at line 20 of file threading.h.

Variable Documentation

◆ always_false

template<class >
constexpr bool ghassanpl::always_false
inlineconstexpr

Definition at line 65 of file cpp23.h.

◆ are_all_flags_set_v

template<auto INT_VALUE, auto... VALUES>
constexpr auto ghassanpl::are_all_flags_set_v
inlineconstexpr

Definition at line 55 of file flag_bits_v.h.

◆ are_any_flags_set_v

template<auto INT_VALUE, auto... VALUES>
constexpr auto ghassanpl::are_any_flags_set_v
inlineconstexpr

Definition at line 51 of file flag_bits_v.h.

◆ crc32_table

constexpr uint32_t ghassanpl::crc32_table[256]
inlinestaticconstexpr

Definition at line 18 of file hashes.h.

◆ crc64_table

constexpr uint64_t ghassanpl::crc64_table[256]
inlinestaticconstexpr

Definition at line 94 of file hashes.h.

◆ flag_bits_v

template<typename RESULT_TYPE , auto... VALUES>
constexpr RESULT_TYPE ghassanpl::flag_bits_v
inlineconstexpr

Definition at line 43 of file flag_bits_v.h.

◆ get_index_v

constexpr size_t ghassanpl::get_index_v
inlineconstexpr

Definition at line 223 of file templates.h.

◆ has_type_v

constexpr bool ghassanpl::has_type_v
inlineconstexpr

Definition at line 226 of file templates.h.

◆ invalid_handle

const file_handle_type ghassanpl::invalid_handle
inline

Definition at line 76 of file mmap.h.

◆ is_any_of_v

template<class T , class... TYPES>
constexpr bool ghassanpl::is_any_of_v
inlineconstexpr

Definition at line 18 of file cpp23.h.

◆ is_enum_flags_v

template<typename TYPE >
constexpr bool ghassanpl::is_enum_flags_v
constexpr

Definition at line 337 of file enum_flags.h.

◆ is_flag_set_v

template<auto INT_VALUE, auto VALUE>
constexpr auto ghassanpl::is_flag_set_v
inlineconstexpr

Definition at line 47 of file flag_bits_v.h.

◆ is_named_v

template<typename OTHER >
constexpr bool ghassanpl::is_named_v
staticconstexpr

Definition at line 296 of file named.h.

◆ map_entire_file

constexpr size_t ghassanpl::map_entire_file
staticconstexpr

Definition at line 68 of file mmap.h.

◆ set_flag_to_v

template<auto INT_VALUE, bool TO, auto... VALUES>
constexpr auto ghassanpl::set_flag_to_v
inlineconstexpr

Definition at line 71 of file flag_bits_v.h.

◆ set_flag_v

template<auto INT_VALUE, auto... VALUES>
constexpr auto ghassanpl::set_flag_v
inlineconstexpr

Definition at line 59 of file flag_bits_v.h.

◆ toggle_flag_v

template<auto INT_VALUE, auto... VALUES>
constexpr auto ghassanpl::toggle_flag_v
inlineconstexpr

Definition at line 67 of file flag_bits_v.h.

◆ unset_flag_v

template<auto INT_VALUE, auto... VALUES>
constexpr auto ghassanpl::unset_flag_v
inlineconstexpr

Definition at line 63 of file flag_bits_v.h.