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  fs
namespace  formats
namespace  pred
 Contains functions that return predicates; appropriate for functions like std::all_of.
namespace  op
 Contains functions that return functors that perform an operation without output; appropriate for functions like std::for_each.
namespace  xf
 Contains functions that return functors which transform and return their inputs somehow; appropriate for not-in-place transformation functions (e.g. std::transform).
namespace  geometry
namespace  integer
 Hash functions that only work on integers.
namespace  noise
 Shamelessly stolen from https://github.com/SRombauts/SimplexNoise/.
namespace  parsing
namespace  random
namespace  regex
namespace  string_ops

Classes

struct  bit_view
 A view over an integral value allowing for iteration and modification of its individual bits. More...
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  enum_flag_changes
 Holds a set of changes to be made to an enum_flags<ENUM, VALUE_TYPE> - conceptually holds a set of std::pair<ENUM, enum_flag_change>. More...
struct  enum_flags
 A (constexpr) value struct that represents a set of bits mapped to an enum (implemented as a bitset). More...
struct  overloaded
 Can be used to create an object with an overload set of operator() if constructed from multiple lambdas. More...
struct  basic_mmap_base
 Base for mmap_source and mmap_sink with a specific value type. More...
struct  mmap_source
 A read-only memory view over a file. More...
struct  mmap_sink
 A read-write 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  named
 Used to create a strong typedef of T. More...
struct  caching_path_reference
 A value that references an object via a (usually string-like) "path"; it lazily resolves the pointer to the object, and caches it. More...
struct  pool
 Very simple object pool implementation. More...
struct  thread_local_pool
 A pool that can be used in a thread-local fashion. More...
struct  scope_guard
 An RAII class that executes a function on destruction. More...
struct  counted_scope_guard
 An RAII class that executes a function on destruction, if its request counter is greater than zero. More...
struct  unique_resource
 An equivalent to unique_ptr for values that are not heap pointers. More...
struct  scoped_value_change
 An RAII class that changes the value of a variable and reverts it to the original value on destruction. More...
struct  scope_counter
 An RAII class that increments a value on construction and decrements it on destruction. More...
struct  sentinel_optional
 An equivalent to std::optional<T> except that instead of keeping an additional bool to indicate value presence, it uses one of the potential values of T as a "sentinel" value to indicate nullopt. More...
struct  string_stringifier
 NOTE: The below is a MAJOR WORK IN PROGRESS. More...
struct  symbol_base
 The base class for all symbols. More...
struct  default_symbol_provider_t
 The default symbol provider usable for most symbol implementations. More...
struct  get_index
 std::variant get index of type More...
struct  protected_object
 A class that stores an object to which access is protected via a mutexlike; all operations are thread-safe unless specified otherwise. More...
union  unititialized_t
 unititialized_t<T> is an appropriately sized and aligned storage for type T, with a useful interface to create and destroy the object More...
struct  decomposed_uri
 Holds the constituents of a URI. More...
struct  known_uri_scheme
 An base class for classes that can validate (and potentially parse more info from) a known URI scheme (e.g. http, file, ftp, etc.). More...
struct  uri_builder
 [Unimplemented] 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...
struct  trec2
 Represents a 2D rectangle polygon_shape. More...

Concepts

concept  bit_integral
 Whether a type is integral (but not a bool).
concept  bit_castable
 Whether two types can be safely bit_cast between each other.
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  bytelike_range
 A range of bytelikes.
concept  range_predicate
 Concept to check if a function is a predicate on the range elements (i.e. returns boolable).
concept  symbol_provider
 The requirements for a symbol provider.
concept  mutexlike
 Anything that's lockable.
concept  timed_mutexlike
 Any mutexlike that can also be attempted to be locked for some time.
concept  shared_mutexlike
 RW mutex (read access can be shared, write access is exclusive).

Typedefs

template<size_t N>
using uintN_t
 An unsigned integer type for the given PoT bit size.
template<typename T>
using uint_sizeof_t
template<size_t N>
using intN_t
 An integer type for the given PoT bit size.
template<typename T>
using int_sizeof_t
template<bool SIGNED, size_t N>
using sintN_t
 A signed integer type for the given PoT bit size.
template<typename BUFFER>
using buffer_element_type
 Resolves to the destination element type of the buffer.
template<typename T>
using buffer_compression_result
template<typename S, typename D>
using copy_const_t
using color_rgba_t
 Represents a color in RGBA color space, with 0.0-1.0 float elements.
using color_hsva_t
 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
 Default color_t type is RGBA.
using color_rgba_u32_t
 Represent a packed RGBA color with 8 bits per pixel.
using color_abgr_u32_t
 Represent a packed ABGR color with 8 bits per pixel.
template<class T>
using type_identity_t
template<class T>
using remove_cvref_t
template<typename FROM, typename TO>
using copy_const
using file_handle_type
using byte_mmap_source
using u8_mmap_source
using char_mmap_source
using char8_mmap_source
template<typename T>
using pooled_ptr
 A version of unique_ptr<T> that returns the object to the (thread-local) pool on destruction.
template<typename RANGE>
using range_value
 Helper template to get the value type of a type that decays to a range.
template<typename RANGE>
using range_iterator
 Helper template to get the iterator type of a type that decays to a range.
template<typename T>
using optional_scoped_value_change
using default_symbol_provider
 A basic symbol_provider suitable for most single-threaded uses.
using symbol
 A symbol type suitable for most single-threaded uses.
template<size_t I, typename... Ts>
using nth_type_of
template<typename... Ts>
using first_type_of
template<typename... Ts>
using last_type_of
template<typename T, shared_mutexlike MUTEX_TYPE = std::shared_mutex>
using shared_protected_object
 Same as protected_object but uses std::shared_mutex by default.
using uri
 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
template<typename T>
using uri_expected
using uri_error

Enumerations

enum class  horizontal_align : int {
  horizontal_align::left , horizontal_align::center , horizontal_align::centre , horizontal_align::right ,
  horizontal_align::justify
}
 Represents an alignment on a horizontal line. More...
enum class  vertical_align : int {
  vertical_align::top , vertical_align::middle , vertical_align::center , vertical_align::centre ,
  vertical_align::bottom , vertical_align::justify
}
 Represents an alignment on a vertical line. More...
enum class  align {
  align::top_left , align::top_center , top_centre , center_top ,
  centre_top , align::top_right , align::middle_left , center_left ,
  centre_left , align::middle_center , center , centre ,
  align::middle_right , center_right , centre_right , align::bottom_left ,
  align::bottom_center , bottom_centre , center_bottom , centre_bottom ,
  align::bottom_right
}
 Represents an alignment in both axes (horizontal and veritcal). More...
enum class  AssumptionHandlerResult { Break , Terminate , Continue }
 Return one of these values from the assumption failure handler AssumptionFailureHandler to trigger a specific behavior at the point of failure. More...
enum class  buffer_compression_error_type { unknown_error , invalid_options }
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...
enum class  enum_flag_change : uint8_t { no_change , set , unset , toggle }
 A change to be done to an enum flag in an enum_flags set. More...
enum class  tween_flags
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
}
 Error codes relating to URI decomposing, composing, and other operations. More...
enum class  uri_decompose_flags {
  split_query_elements , split_path_elements , uri_decompose_flags::use_well_known_port_numbers , lowercase_when_appropriate ,
  normalize_path , query_known_scheme , validate_known_scheme
}
 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)
template<typename T>
constexpr align relative_alignment (glm::tvec2< T > pt, trec2< T > const &rect)
constexpr align operator| (horizontal_align first, vertical_align second) noexcept
 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) noexcept
 You can use the | operator to create an align from a horizontal_align and a vertical_align.
constexpr align & operator|= (align &first, horizontal_align second) noexcept
constexpr align & operator|= (align &first, vertical_align second) noexcept
constexpr const char * to_name (horizontal_align h) noexcept
 Get alignment name.
constexpr const char * to_name (vertical_align v) noexcept
 Get alignment name.
constexpr const char * to_name (align a) noexcept
 Get alignment name.
constexpr const char * to_natural_name (align a) noexcept
 Get natural alignment name.
constexpr vertical_align to_vertical (horizontal_align alignment) noexcept
 Returns alignment as if it was on a vertical line.
constexpr vertical_align to_vertical (vertical_align alignment) noexcept
 Returns alignment as if it was on a vertical line.
constexpr horizontal_align to_horizontal (vertical_align alignment) noexcept
 Returns alignment as if it was on a horizontal line.
constexpr horizontal_align to_horizontal (horizontal_align alignment) noexcept
 Returns alignment as if it was on a horizontal line.
constexpr vertical_align vertical_from (align alignment) noexcept
 Gets just the vertical component from the align (as a vertical_align).
constexpr horizontal_align horizontal_from (align alignment) noexcept
 Gets just the horizontal component from the align (as a horizontal_align).
constexpr align only_vertical (align alignment) noexcept
 Gets a mew align that only has the vertical component.
constexpr align only_horizontal (align alignment) noexcept
 Gets a mew align that only has the horizontal component.
constexpr vertical_align to_opposite (vertical_align alignment) noexcept
 Returns the opposite aligment.
constexpr horizontal_align to_opposite (horizontal_align alignment) noexcept
 Returns the opposite aligment.
constexpr align to_opposite (align alignment) noexcept
 Gets an align that is opposite on bost axes.
constexpr align rotated_clockwise (align alignment) noexcept
 Returns the 2D alignment rotated clockwise.
constexpr align rotated_counter_clockwise (align alignment) noexcept
 Like rotated_clockwise but counter clockwise.
constexpr align flipped_horizontally (align alignment) noexcept
constexpr align flipped_vertically (align alignment) noexcept
template<typename T>
constexpr T aligned (const T &width, const T &max_width, horizontal_align align) noexcept
template<typename T>
constexpr T aligned (const T &width, const T &max_width, vertical_align align) noexcept
auto DefaultReportAssumptionFailure (std::string_view expectation, std::initializer_list< std::pair< std::string_view, std::string > > values, std::string data, source_location loc) -> AssumptionHandlerResult
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<size_t BEGIN, size_t END, bit_integral T>
constexpr T extract_bits (T value)
 Returns just the bits between BEGIN and END in value.
template<size_t... RANGES, bit_integral T>
constexpr auto split_bit_ranges (T value)
template<size_t N, bit_integral T>
constexpr bool bit_at (T bits)
template<bit_integral... BIT_TYPES>
constexpr auto cat_bits (BIT_TYPES... bits)
 Creates a new integral value by concatenating the given bit values.
template<size_t... BIT_COUNT, bit_integral... BIT_TYPES>
constexpr auto cat_bits_n (BIT_TYPES... values)
 Creates a new integral value by concatenating the given bit values, each truncated to the given bit count.
template<size_t N, bit_integral T>
constexpr T n_most_significant (T value)
template<size_t N, bit_integral T>
constexpr T n_least_significant (T 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<bit_integral T>
constexpr auto split_bits (T v) noexcept
 Returns a pair of integers with the N/2 most significant and least significant bits of the given N-bit integer.
template<std::unsigned_integral T>
constexpr T bit_reverse (T x) noexcept
 Reverses the bits of x so that the least significant bit becomes the most significant.
template<std::unsigned_integral T>
constexpr T bit_repeat (T x, int length) noexcept(false)
 Repeats a pattern stored in the least significant length bits of x, as many times as fits into x.
template<std::unsigned_integral T>
constexpr T bit_compress (T x, T m) noexcept
 For each one-bit in m, the corresponding bit in x is taken and packed contiguously into the result, starting with the least significant result bit.
template<std::unsigned_integral T>
constexpr T bit_expand (T x, T m) noexcept
 For each one-bit in m, a bit from x, starting with the least significant bit is taken and shifted into the corresponding position of the m bit.
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>
size_t buffer_append_range (BUFFER &buffer, RANGE &&range)
 Appends elements in the range to the buffer.
template<typename BUFFER, typename 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>
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>
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>>
size_t buffer_append_varint (BUFFER &buffer, std::integral auto oval)
 Appends a variable number of uint8_ts to the buffer that encode the value oval in a minimal amount of space.
template<typename BUFFER, typename ELEMENT_TYPE = buffer_element_type<BUFFER>>
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>>
size_t buffer_append_utf8 (BUFFER &buffer, STRING_TYPE &&str)
 Appends UTF-8 codeunits that represent the char32_t-based range str to the buffer.
template<typename BUFFER, typename POD>
size_t buffer_append_pod (BUFFER &buffer, POD const &pod)
 Appends a POD value's internal object representation to a buffer.
template<typename COMPRESSOR>
buffer_compression_result< void > compressor_restart (COMPRESSOR &comp)=delete
template<typename COMPRESSOR, typename BUFFER>
buffer_compression_result< void > compressor_compress_fragment (COMPRESSOR &comp, bytelike_range auto &&input_range, BUFFER &output_buffer)=delete
template<typename COMPRESSOR, typename BUFFER>
buffer_compression_result< void > compressor_finalize (COMPRESSOR &comp, BUFFER &output_buffer)=delete
template<typename BUFFER, bytelike_range RANGE, typename COMPRESSOR>
buffer_compression_result< void > buffer_append_compressed (BUFFER &buffer, RANGE &&input_range, COMPRESSOR &comp)
template<bytelike TO, typename FROM, size_t N = std::dynamic_extent>
std::span< TO > as_bytelikes (std::span< FROM, N > elements) noexcept
 Converts a span of trivial values to a span of bytelike s.
template<typename TO, bytelike FROM>
TO from_bytelikes (std::span< FROM const > from)
 Returns an object whose internal representation is initialized from the argument.
template<typename TO, bytelike FROM>
std::span< TO > span_from_bytelikes (std::span< FROM > from)
 Returns an object whose internal representation is initialized from the argument.
template<bytelike TO, typename T>
auto as_bytelikes (T &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
 Bit-casts the given bytelike to a uint8_t.
template<bytelike FROM>
constexpr auto to_char (FROM byte) noexcept
 Bit-casts the given bytelike to a char.
template<bytelike FROM>
constexpr auto to_byte (FROM byte) noexcept
 Bit-casts the given bytelike to a std::byte.
template<bytelike FROM>
constexpr auto to_uchar (FROM byte) noexcept
 Bit-casts the given bytelike to a unsigned char.
template<bytelike FROM>
constexpr auto to_char8 (FROM byte) noexcept
 Bit-casts the given bytelike to a char8_t.
template<bytelike FROM, size_t N = std::dynamic_extent>
auto as_chars (std::span< FROM, N > bytes) noexcept
 Returns a span of chars that represents the bytelikes in bytes.
template<bytelike FROM, size_t N = std::dynamic_extent>
auto as_bytes (std::span< FROM, N > bytes) noexcept
 Returns a span of std::bytes that represents the bytelikes in bytes.
template<bytelike FROM, size_t N = std::dynamic_extent>
auto as_uchars (std::span< FROM, N > bytes) noexcept
 Returns a span of unsigned chars that represents the bytelikes in bytes.
template<bytelike FROM, size_t N = std::dynamic_extent>
auto as_u8s (std::span< FROM, N > bytes) noexcept
 Returns a span of uint8_ts that represents the bytelikes in bytes.
template<bytelike FROM, size_t N = std::dynamic_extent>
auto as_char8s (std::span< FROM, N > bytes) noexcept
 Returns a span of char8_ts that represents the bytelikes in bytes.
template<typename T>
auto as_chars (T const &data) noexcept
 Returns a span of chars that represents the internal object representation of the data object.
template<typename T>
auto as_bytes (T const &data) noexcept
 Returns a span of std::bytes that represents the internal object representation of the data object.
template<typename T>
auto as_uchars (T const &data) noexcept
 Returns a span of unsigned chars that represents the internal object representation of the data object.
template<typename T>
auto as_u8s (T const &data) noexcept
 Returns a span of uint8_ts that represents the internal object representation of the data object.
template<typename T>
auto as_char8s (T const &data) noexcept
 Returns a span of char8_ts that represents the internal object representation of the data object.
template<bytelike B, size_t N = std::dynamic_extent>
bool nth_bit (std::span< B const, N > range, size_t n) noexcept
 Returns the value of the nth bit in the range of bytelikes.
template<bytelike B, size_t N = std::dynamic_extent>
void set_nth_bit (std::span< B, N > range, size_t n, bool value) noexcept
 Sets the value of the nth bit in the range of bytelikes.
template<typename T>
bool nth_bit (T const &pod, size_t n) noexcept
 Returns the value of the nth bit in the internal object representation of the pod object.
template<typename T>
void set_nth_bit (T &pod, size_t n, bool value) noexcept
 Sets the value of the nth bit in the internal object representation of the pod object.
template<size_t N, bytelike B, size_t SN = std::dynamic_extent>
bool nth_bit (std::span< B const, SN > range) noexcept
 Returns the value of the Nth bit in the range of bytelikes.
template<size_t N, bytelike B, size_t SN = std::dynamic_extent>
void set_nth_bit (std::span< B, SN > range, bool value) noexcept
 Sets the value of the Nth bit in the range of bytelikes.
template<size_t N, typename T>
bool nth_bit (T const &pod) noexcept
 Returns the value of the Nth bit in the internal object representation of the pod object.
template<size_t N, typename T>
void set_nth_bit (T &pod, bool value) noexcept
 Sets the value of the Nth bit in the internal object representation of the pod object.
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 >
 Splits the argument span into three spans, the first one being the prefix, the second one capable of storing one ore more objects of type TO with the proper alignment, and the third one being the suffix.
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 >
 Does the same as aligned_span_cast but then default-constructs the elements of the of middle span.
constexpr color_t premultiplied (color_t const &color)
 Returns the color multiplied by its own alpha.
constexpr color_t with_alpha (color_t const &color, float a)
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 color_t from_u8_rgb (uint8_t r, uint8_t g, uint8_t b)
constexpr color_t from_u8_rgba (uint8_t r, uint8_t g, uint8_t b, uint8_t a)
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<std::same_as< color_abgr_u32_t > TO>
constexpr TO named_cast (color_rgba_t const &from)
template<typename TO, typename FROM>
constexpr TO color_cast (FROM const &from)
constexpr glm::tvec4< uint8_t > to_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 T, typename U>
constexpr auto push_back_unique (std::vector< T > &vector, U &&value)
 Pushes a value to a vector if it doesn't already exists.
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< V > erase_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::vector< T > erase_swap_if (std::vector< T > &vector, PRED &&pred)
 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>
auto map_at_or_default (MAP &&map, KEY &&key)
 Finds the value associated with key in the map and retuns it, or def if none found.
template<typename KEY, typename MAP>
decltype(auto) map_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().
template<class T, class U>
constexpr std::unique_ptr< T > dynamic_pointer_cast (std::unique_ptr< U > &&r) noexcept
template<class T, class U>
constexpr std::unique_ptr< T > dynamic_steal_cast (std::unique_ptr< U > &r) noexcept
template<class T, class D, class U>
constexpr std::unique_ptr< T, D > dynamic_pointer_cast (std::unique_ptr< U, D > &&r) noexcept
template<class T, class U>
constexpr std::unique_ptr< T > static_pointer_cast (std::unique_ptr< U > &&r) noexcept
template<class T, class D, class U>
constexpr std::unique_ptr< T, D > static_pointer_cast (std::unique_ptr< U, D > &&r) noexcept
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>
constexpr T byteswap (const T val) noexcept
void unreachable () noexcept
template<typename ENUM_TYPE>
 GHPL_REQUIRES (std::is_enum_v< ENUM_TYPE >) struct circular_enum
 TODO: Finish this.
template<typename ENUM_TYPE>
 GHPL_REQUIRES (std::is_enum_v< ENUM_TYPE >) const expr auto IncWrap(ENUM_TYPE &val) noexcept
intptr_t GetLastSystemError ()
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 RESULT_TYPE = unsigned long long, typename BIT_TYPE>
constexpr RESULT_TYPE bit_to_flag (BIT_TYPE bit) noexcept
template<typename INTEGRAL, typename 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>
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>
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>
constexpr void set_flags (INTEGRAL &bits, ARGS... args) noexcept
 Sets the bits at numbers represented by args in bits.
template<typename INTEGRAL, typename... 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>
constexpr void toggle_flags (INTEGRAL &bits, ARGS... args) noexcept
 Toggles the bits at numbers represented by args in bits.
template<typename INTEGRAL, typename... 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>
constexpr 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>
constexpr 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>
constexpr auto transformed (std::optional< T > const &value, FUNC &&func) -> decltype(std::optional{ func(value.value()) })
 Pre C++23 transform/fmap.
template<typename T, typename FUNC>
constexpr auto transformed (std::optional< T > &&value, FUNC &&func) -> decltype(std::optional{ func(value.value()) })
 Pre C++23 transform/fmap.
template<typename T>
std::optional< T > to_optional (T *value) noexcept
template<typename T>
std::optional< T > move_to_optional (T *value) noexcept
template<typename T>
constexpr auto flattened (std::optional< std::optional< T > > &&value)
template<typename T>
constexpr auto flattened (std::optional< T > &&value)
template<typename T>
constexpr auto flattened (std::optional< std::optional< T > > const &value)
template<typename T>
constexpr auto flattened (std::optional< T > const &value)
template<typename T, typename FUNC>
constexpr T resulting (FUNC &&func)
 Returns a new T transformed by func.
template<typename FUNC>
 GHPL_REQUIRES ((!std::is_void_v< typename decltype(detail::detect_first_arg(std::function{ std::declval< FUNC >() }))::type > &&requires { std::function{ std::declval< FUNC >() };})) const expr auto resulting(FUNC &&func)
 Returns a new object transformed by func. The first argument to func determines what the object's type is.
template<typename T, typename... ARGS>
constexpr std::optional< T > optional_get (std::variant< ARGS... > const &var) noexcept
 Variant operations.
template<typename FUNC, typename... Ts>
constexpr auto transformed (std::variant< Ts... > const &var, FUNC &&func)
 Returns a new variant transformed by func.
template<typename... TYPES>
 convertible_to_variant (std::variant< TYPES... >) -> convertible_to_variant< TYPES... >
template<typename T>
 convertible_to_variant (T) -> convertible_to_variant< remove_cvref_t< T > >
template<typename FUNC, typename... Ts>
constexpr auto transformed_flattened (std::variant< Ts... > const &var, FUNC &&func)
 Returns a new variant transformed by func, flattened.
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.
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.
template<bytelike_range RANGE>
constexpr uint64_t fnv64 (RANGE &&bytes)
 Calculates a FNV Hash for a range of bytes.
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
 Combines an existing hash with a new hash value.
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{})
 Combines an existing hash value (seed) with the hash of value v.
template<template< typename > typename HASHER = std::hash, typename FIRST, typename... T>
constexpr uint64_t hash64 (FIRST const &first, T &&... values)
 Performs a hash of multiple values.
template<typename It, typename HASHER = std::hash<std::iter_value_t<It>>>
constexpr void fold_in_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 T>
constexpr T default_value () noexcept
template<>
constexpr void default_value< void > () noexcept
template<typename VALUE_TYPE = char>
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 = char>
mmap_source< VALUE_TYPE > make_mmap_source (const std::filesystem::path &path, std::error_code &error) noexcept
template<typename VALUE_TYPE = char>
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 = char>
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<typename T, typename... ARGS>
thread_local_pool< T >::pooled_ptr make_pooled (ARGS &&... args)
 Helper to create pooled_ptrs ala make_unique.
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(auto) at (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(auto) 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 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>
constexpr auto find_index (RANGE const &range, FUNC &&pred) -> std::iter_difference_t< range_iterator< RANGE > >
 Find a value in range that matches pred, and returns an index to it.
template<std::ranges::range RANGE, typename FUNC>
constexpr auto find_ptr (RANGE &range, FUNC &&pred)
 Find a value in range that matches pred, and returns a pointer to it, or null if none found.
template<random_access_range RANGE, typename FUNC, typename DEF_TYPE = range_value<RANGE>>
auto find_if_or_default (RANGE &range, FUNC &&pred, DEF_TYPE &&default_value=DEF_TYPE{})
 Find a value in range that matches pred, and returns it, or default_value if none found.
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<template< typename > typename HASHER, typename FIRST, typename... T>
constexpr size_t hash (FIRST &&first, T &&... values)
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, 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 T>
span< T > consume_n (span< T > &s, size_t n)
template<typename T>
decltype(auto) consume (span< T > &s)
template<char open = '[', char close = ']', typename FUNC>
std::string interpolate_simple (std::string_view str, FUNC &&func)
 The simplest string interpolation function; calls func for every [group] in str.
template<char open = '[', char close = ']', typename FUNC>
std::string interpolate_recursive (std::string_view str, FUNC &&func)
 Like interpolate_simple except [group]s can be recursive, that is, can contain other groups that will be interpolated before the outer group.
template<bool SYNTAX>
std::string interpolate_eval (std::string_view str, eval::environment< SYNTAX > &env)
 Interpolation using the eval module functionality.
template<std::floating_point T>
std::string to_string (T floating_point)
 float overload
template<typename T>
std::string to_string (T integral)
 integral overload
template<std::same_as< char > T>
std::string to_string (T c)
 char overload
template<typename T>
std::string to_string (T &&val)
 string-like overload
std::string to_string (nullptr_t)
 nullptr overload
template<typename T>
bool eat_from_string (std::string_view &from, T &&val)
template<typename T, template< bool > typename STRINGIFIER = string_stringifier>
std::string to_string (T &&val)
template<typename T, template< bool > typename STRINGIFIER = string_stringifier>
bool from_string (std::string_view val, T &target)
template<typename T, template< bool > typename STRINGIFIER = string_stringifier>
T 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>
constexpr void for_each_pair (FUNC &&f, ARGS &&... args)
 Function: for_each_pair TODO: Description.
template<typename... ARGS, typename FUNC>
constexpr auto 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>
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>
auto is (X const *x) -> bool
template<typename C>
auto as (...) -> auto
template<typename C, typename 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>
auto as (X &&x) -> C &&
template<typename C, typename X>
auto as (X &x) -> C &
template<typename C, typename X>
auto as (X const &x) -> C const &
template<typename C, typename X>
auto as (X *x) -> C *
template<typename C, typename 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>
constexpr auto is (X const &x) -> bool
template<typename T, typename X>
constexpr auto as (X const &x) -> T
template<typename T, typename U>
constexpr auto is (std::optional< U > const &x) -> bool
template<typename... ARGS, typename FUNC>
constexpr auto for_each_in_tuple (std::tuple< ARGS... > &&t, FUNC &&f)
template<mutexlike MUTEX_TYPE, typename FUNC, typename... ARGS>
auto under_protection (MUTEX_TYPE &m, FUNC &&func, ARGS &&... args)
 Runs func under the protection of mutexlike m.
template<shared_mutexlike MUTEX_TYPE, typename FUNC, typename... ARGS>
auto under_read_protection (MUTEX_TYPE &m, FUNC &&func, ARGS &&... args)
 Runs func under the read (shared) protection of mutexlike m.
template<mutexlike MUTEX_TYPE, typename T>
auto protected_copy (MUTEX_TYPE &m, T &&t)
 Creates a copy of t under the protection of mutexlike m.
template<mutexlike MUTEX_TYPE, typename T>
auto protected_move (MUTEX_TYPE &m, T &&t)
 Moves t under the protection of mutexlike m.
template<mutexlike MUTEX_TYPE, typename T, typename U>
auto protected_exchange (MUTEX_TYPE &m, T &t, U &&u) -> T
 Exchanges t with u and returns the value of t, all under the protection of mutexlike m.
template<detail::sized T>
 unititialized_t (paren_init_t, T) -> unititialized_t< T >
template<detail::sized T>
 unititialized_t (brace_init_t, T) -> unititialized_t< T >
uri_expected< std::string_view > extract_scheme (uri_view uri) noexcept
uri_expected< std::string_view > extract_authority (uri_view uri) noexcept
 [Unimplemented]
uri_expected< std::string_view > extract_path (uri_view uri) noexcept
 [Unimplemented]
template<typename FUNC>
uri_expected< void > extract_path_elements (uri_view uri, FUNC &&func) noexcept
 [Unimplemented]
uri_expected< std::string_view > extract_query (uri_view uri) noexcept
 [Unimplemented]
uri_expected< std::string_view > extract_fragment (uri_view uri) noexcept
 [Unimplemented]
template<typename FUNC>
uri_expected< void > extract_query_elements (uri_view uri, FUNC &&func) noexcept
 [Unimplemented]
uri_expected< uri > make_uri_safe_for_display (uri_view uri)
 [Unimplemented] Removes data that should not be displayed to an untrusted user (user-info after the first ':', perhaps other things)
uri_expected< decomposed_uri > decompose_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< uri > compose_uri (decomposed_uri const &decomposed, enum_flags< uri_compose_flags > flags=enum_flags< uri_compose_flags >::all())
 [Unimplemented]
uri_expected< uri > normalize_uri (uri_view uri)
 [Unimplemented] Converts a URI to a normalized form
known_uri_scheme const * query_uri_scheme (std::string_view scheme)
 Looks up the scheme in the internal URI scheme database.
uri_expected< uri > compose_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 little-endian representation.
template<bit_integral B>
constexpr B from_big_endian (B val) noexcept
 Returns val (in big-endian representation) converted into native representation.
template<bit_integral B>
constexpr B from_little_endian (B val) noexcept
 Returns val (in little-endian representation) converted into native 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<std::endian ENDIANNESS, bit_integral B>
constexpr B from_endian (B val) noexcept
 Returns val (in ENDIANNESS representation) converted into native representation.
template<bit_integral B>
constexpr B from_endian (B val, std::endian endianness) noexcept
 Returns val (in endianness representation) converted into native representation.
consteval Hash Functions
template<typename 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>
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
Span Operations
template<typename T, size_t N = std::dynamic_extent>
constexpr std::pair< span< T >, span< T > > split_at (span< T, N > spn, size_t index)
template<typename T, size_t N = std::dynamic_extent>
constexpr std::array< span< T >, 3 > split_at (span< T, N > spn, size_t index, size_t size)
template<typename T, size_t N = std::dynamic_extent>
constexpr std::pair< T *, T * > as_range (span< T, N > spn)
constexpr auto as_span (std::ranges::range auto &range)
template<typename TO, typename FROM, size_t N = std::dynamic_extent>
auto span_cast (span< FROM, N > bytes) noexcept
 Casts a span of objects of type FROM to a span of objects of type TO.
template<typename T1, size_t N1, typename T2, size_t N2>
constexpr bool are_adjacent (span< T1, N1 > s1, span< T2, N2 > s2)
template<typename T1, size_t N1, typename T2, size_t N2>
constexpr bool are_overlapping (span< T1, N1 > s1, span< T2, N2 > s2)
template<typename T, size_t N1, typename U, size_t N2>
constexpr bool ends_with (span< T, N1 > s1, span< U, N2 > s2)
template<typename T, size_t N1, typename U, size_t N2>
constexpr bool starts_with (span< T, N1 > s1, span< U, N2 > s2)
Array Operations
template<typename T, std::size_t... Ns>
constexpr auto join (std::array< T, Ns >... arrays)
template<typename T, size_t LL, typename... ARGS>
constexpr auto join (std::array< T, LL > rhs, ARGS &&... args)

Variables

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 char * horizontal_align_names []
constexpr const char * vertical_align_names []
constexpr const char * align_names []
constexpr const char * align_names_natural []
auto(* AssumptionFailureHandler )(std::string_view expectation, std::initializer_list< std::pair< std::string_view, std::string > > values, std::string data, source_location loc) -> AssumptionHandlerResult=nullptr
 This variable should be set to a handler function by your own code, as it is called by an assumption macro with a failing assumption; if you do not provide it, an exception with an unspecified type will be thrown.
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.
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
std::vector< error_context_datum const * > error_context_stack
template<typename T>
constexpr bool is_expected
template<typename E, typename T>
constexpr bool is_expected_with_error
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
template<typename TYPE, typename TYPE_CONTAINER>
constexpr size_t get_index_v
template<typename TYPE, typename TYPE_CONTAINER>
constexpr bool has_type_v
struct ghassanpl::default_init_t default_init
 Constructor tag to default-construct the object inside an unititialized_t.
struct ghassanpl::paren_init_t paren_init
 Constructor tag to paren-construct the object inside an unititialized_t.
struct ghassanpl::brace_init_t brace_init
 Constructor tag to brace-construct the object inside an unititialized_t.

C++23 Compatibility

constexpr __contains_fn contains
 contains(range, el)
constexpr __contains_subrange_fn contains_subrange
 contains_subrange(range, subrange)
template<class CONTAINER, std::ranges::input_range RANGE, class... TYPES>
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)

Detailed Description

Primary namespace for everything in this library.

DEPRECATED: Use the moal library instead of this functionality.

Based on https://github.com/oracle-9/maybe_uninit/ so I guess this file is specifically under the GPL 3 license: https://github.com/oracle-9/maybe_uninit/blob/main/LICENSE.

This Source Code Form is subject to the terms of the Mozilla Public License, v.

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

TODO: This could be made compliant with C++17, but I'm lazy (thanks, Copilot).

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.

TODO:

Only for CHAR_BIT, sigh.

ALA boost::leaf's on_error: https://www.boost.org/doc/libs/latest/libs/leaf/doc/html/index.html#on_error.

TODO: Make magic_enum optional, and force the user to define the array count if not available.

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.

  • lerp, unlerp, etc
  • splines
  • easing functions
  • approach
  • blink/square wave
  • triangle wave
  • sawtooth

    2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.


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 190 of file templates.h.

Typedef Documentation

◆ buffer_compression_result

template<typename T>
using ghassanpl::buffer_compression_result

Definition at line 276 of file buffers.h.

◆ copy_const

template<typename FROM, typename TO>
using ghassanpl::copy_const

Definition at line 33 of file cpp17.h.

◆ copy_const_t

template<typename S, typename D>
using ghassanpl::copy_const_t

Definition at line 18 of file bytes.h.

◆ file_handle_type

using ghassanpl::file_handle_type

Definition at line 73 of file mmap.h.

◆ first_type_of

template<typename... Ts>
using ghassanpl::first_type_of

Definition at line 22 of file templates.h.

◆ last_type_of

template<typename... Ts>
using ghassanpl::last_type_of

Definition at line 24 of file templates.h.

◆ nth_type_of

template<size_t I, typename... Ts>
using ghassanpl::nth_type_of

Definition at line 20 of file templates.h.

◆ remove_cvref_t

template<class T>
using ghassanpl::remove_cvref_t

Definition at line 26 of file cpp17.h.

◆ type_identity_t

template<class T>
using ghassanpl::type_identity_t

Definition at line 18 of file cpp11.h.

Enumeration Type Documentation

◆ AssumptionHandlerResult

Return one of these values from the assumption failure handler AssumptionFailureHandler to trigger a specific behavior at the point of failure.

Enumerator
Break 

Break into debugger after reporting the assumption failure.

Terminate 

Terminate the program after reporting the assumption failure.

Continue 

Continue execution after reporting the assumption failure.

Definition at line 377 of file assuming.h.

◆ buffer_compression_error_type

enum class ghassanpl::buffer_compression_error_type
strong

Definition at line 261 of file buffers.h.

◆ tween_flags

enum class ghassanpl::tween_flags
strong

Definition at line 12 of file tweener.h.

Function Documentation

◆ aligned() [1/2]

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

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

◆ aligned() [2/2]

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

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

◆ apply_to_nth()

template<size_t N, typename FUNC, typename... ARGS>
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 520 of file templates.h.

◆ apply_to_slice() [1/3]

template<size_t Begin, double & ..., typename FUNC, typename... ARGS>
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 574 of file templates.h.

◆ apply_to_slice() [2/3]

template<size_t Begin, size_t End, double & ..., typename FUNC, typename... ARGS>
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 568 of file templates.h.

◆ apply_to_slice() [3/3]

template<size_t Begin, size_t End, size_t Stride, double & ..., typename FUNC, typename... ARGS>
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 562 of file templates.h.

◆ as() [1/10]

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

Definition at line 139 of file templates.h.

◆ as() [2/10]

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

Definition at line 243 of file templates.h.

◆ as() [3/10]

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

Definition at line 158 of file templates.h.

◆ as() [4/10]

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

Definition at line 164 of file templates.h.

◆ as() [5/10]

template<typename C, typename X>
auto ghassanpl::as ( X * x) -> C *
nodiscard

Definition at line 176 of file templates.h.

◆ as() [6/10]

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
nodiscard

Definition at line 150 of file templates.h.

◆ as() [7/10]

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

Definition at line 145 of file templates.h.

◆ as() [8/10]

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

Definition at line 170 of file templates.h.

◆ as() [9/10]

template<typename T, typename X>
auto ghassanpl::as ( X const & x) -> T
nodiscardconstexpr

Definition at line 267 of file templates.h.

◆ as() [10/10]

template<typename C, typename X>
auto ghassanpl::as ( X const * x) -> C const *
nodiscard

Definition at line 182 of file templates.h.

◆ buffer_append_compressed()

template<typename BUFFER, bytelike_range RANGE, typename COMPRESSOR>
buffer_compression_result< void > ghassanpl::buffer_append_compressed ( BUFFER & buffer,
RANGE && input_range,
COMPRESSOR & comp )

Definition at line 295 of file buffers.h.

◆ byteswap()

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

Definition at line 136 of file cpp23.h.

◆ byteswap_uint64()

unsigned long long ghassanpl::byteswap_uint64 ( const unsigned long long val)
nodiscardconstexprnoexcept

Definition at line 129 of file cpp23.h.

◆ byteswap_ulong()

unsigned long ghassanpl::byteswap_ulong ( const unsigned long val)
nodiscardconstexprnoexcept

Definition at line 125 of file cpp23.h.

◆ byteswap_ushort()

unsigned short ghassanpl::byteswap_ushort ( const unsigned short val)
nodiscardconstexprnoexcept

Definition at line 121 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 60 of file expected.h.

◆ compose_uri()

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

Definition at line 318 of file uri_impl.h.

◆ consume()

template<typename T>
decltype(auto) ghassanpl::consume ( span< T > & s)
nodiscard

Definition at line 46 of file span.h.

◆ consume_n()

template<typename T>
span< T > ghassanpl::consume_n ( span< T > & s,
size_t n )
nodiscard

Definition at line 38 of file span.h.

◆ default_value()

template<typename T>
T ghassanpl::default_value ( )
constexprnoexcept

Definition at line 22 of file cpp11.h.

◆ default_value< void >()

template<>
void ghassanpl::default_value< void > ( )
constexprnoexcept

Definition at line 24 of file cpp11.h.

◆ DefaultReportAssumptionFailure()

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

Definition at line 384 of file assuming.h.

◆ dynamic_pointer_cast() [1/2]

template<class T, class U>
std::unique_ptr< T > ghassanpl::dynamic_pointer_cast ( std::unique_ptr< U > && r)
constexprnoexcept

Definition at line 34 of file cpp23.h.

◆ dynamic_pointer_cast() [2/2]

template<class T, class D, class U>
std::unique_ptr< T, D > ghassanpl::dynamic_pointer_cast ( std::unique_ptr< U, D > && r)
constexprnoexcept

Definition at line 52 of file cpp23.h.

◆ dynamic_steal_cast()

template<class T, class U>
std::unique_ptr< T > ghassanpl::dynamic_steal_cast ( std::unique_ptr< U > & r)
constexprnoexcept

Definition at line 43 of file cpp23.h.

◆ eat_from_string()

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

Definition at line 70 of file stringification.h.

◆ enumerate_pack()

template<typename FUNC, typename... ARGS>
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 493 of file templates.h.

◆ first_value_of()

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

Definition at line 39 of file templates.h.

◆ for_each()

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

Function: for_each TODO: Description.

Definition at line 463 of file templates.h.

◆ for_each_in_tuple() [1/2]

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

Definition at line 478 of file templates.h.

◆ for_each_in_tuple() [2/2]

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

Function: for_each_in_tuple.

Definition at line 469 of file templates.h.

◆ for_each_pair()

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

Function: for_each_pair TODO: Description.

Definition at line 331 of file templates.h.

◆ forward_like()

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

Definition at line 94 of file cpp23.h.

◆ from_string() [1/2]

template<typename T, template< bool > typename STRINGIFIER = string_stringifier>
T ghassanpl::from_string ( std::string_view val)
nodiscard

Definition at line 143 of file stringification.h.

◆ from_string() [2/2]

template<typename T, template< bool > typename STRINGIFIER = string_stringifier>
bool ghassanpl::from_string ( std::string_view val,
T & target )

Definition at line 133 of file stringification.h.

◆ get_last_windows_error()

last_windows_error_t ghassanpl::get_last_windows_error ( )
inlinenodiscard

Definition at line 30 of file last_error.h.

◆ GHPL_REQUIRES() [1/2]

template<typename ENUM_TYPE>
ghassanpl::GHPL_REQUIRES ( std::is_enum_v< ENUM_TYPE > ) const &
noexcept

Definition at line 39 of file enums.h.

◆ GHPL_REQUIRES() [2/2]

template<typename ENUM_TYPE>
ghassanpl::GHPL_REQUIRES ( std::is_enum_v< ENUM_TYPE > )

TODO: Finish this.

Definition at line 23 of file enums.h.

◆ is() [1/5]

template<typename T, typename U>
auto ghassanpl::is ( std::optional< U > const & x) -> bool
nodiscardconstexpr

Definition at line 285 of file templates.h.

◆ is() [2/5]

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

Definition at line 231 of file templates.h.

◆ is() [3/5]

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

Shamelessly stolen from hsutter's cppfront.

Definition at line 103 of file templates.h.

◆ is() [4/5]

template<typename T, typename X>
auto ghassanpl::is ( X const & x) -> bool
nodiscardconstexpr

Definition at line 253 of file templates.h.

◆ is() [5/5]

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

Definition at line 127 of file templates.h.

◆ last_value_of()

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

Definition at line 46 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 433 of file named.h.

◆ named_cast()

template<std::same_as< color_abgr_u32_t > TO>
TO ghassanpl::named_cast ( color_rgba_t const & from)
nodiscardconstexpr

Definition at line 211 of file colors.h.

◆ nth_value_of()

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

Definition at line 27 of file templates.h.

◆ relative_alignment()

template<typename T>
align ghassanpl::relative_alignment ( glm::tvec2< T > pt,
trec2< T > const & rect )
nodiscardconstexpr

TL TO TR

LE | MI | RI

BL BO BR

◆ static_pointer_cast() [1/2]

template<class T, class U>
std::unique_ptr< T > ghassanpl::static_pointer_cast ( std::unique_ptr< U > && r)
constexprnoexcept

Definition at line 63 of file cpp23.h.

◆ static_pointer_cast() [2/2]

template<class T, class D, class U>
std::unique_ptr< T, D > ghassanpl::static_pointer_cast ( std::unique_ptr< U, D > && r)
constexprnoexcept

Definition at line 69 of file cpp23.h.

◆ stringify() [1/4]

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

Definition at line 65 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 427 of file named.h.

◆ stringify() [3/4]

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

Definition at line 388 of file rec2.h.

◆ stringify() [4/4]

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

Definition at line 390 of file rec2.h.

◆ to_string() [1/3]

template<typename T, template< bool > typename STRINGIFIER = string_stringifier>
std::string ghassanpl::to_string ( T && val)
nodiscard

Definition at line 123 of file stringification.h.

◆ to_string() [2/3]

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

char overload

Definition at line 31 of file stringification.h.

◆ to_string() [3/3]

template<typename T>
std::string ghassanpl::to_string ( T integral)
nodiscard

integral overload

Definition at line 27 of file stringification.h.

◆ transform_tuple()

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

Function: transform_tuple.

Definition at line 487 of file templates.h.

◆ unreachable()

void ghassanpl::unreachable ( )
inlinenoexcept

Definition at line 156 of file cpp23.h.

Variable Documentation

◆ are_all_flags_set_v

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

Definition at line 56 of file flag_bits_v.h.

◆ are_any_flags_set_v

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

Definition at line 52 of file flag_bits_v.h.

◆ error_context_stack

std::vector<error_context_datum const*> ghassanpl::error_context_stack
inlinethread_local

Definition at line 34 of file error_context.h.

◆ flag_bits_v

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

Definition at line 44 of file flag_bits_v.h.

◆ get_index_v

template<typename TYPE, typename TYPE_CONTAINER>
size_t ghassanpl::get_index_v
inlineconstexpr

Definition at line 220 of file templates.h.

◆ has_type_v

template<typename TYPE, typename TYPE_CONTAINER>
bool ghassanpl::has_type_v
inlineconstexpr

Definition at line 223 of file templates.h.

◆ invalid_handle

const file_handle_type ghassanpl::invalid_handle
inline

Definition at line 76 of file mmap.h.

◆ is_enum_flags_v

template<typename TYPE>
bool ghassanpl::is_enum_flags_v
constexpr

Definition at line 380 of file enum_flags.h.

◆ is_expected

template<typename T>
bool ghassanpl::is_expected
constexpr

Definition at line 51 of file expected.h.

◆ is_expected_with_error

template<typename E, typename T>
bool ghassanpl::is_expected_with_error
constexpr

Definition at line 53 of file expected.h.

◆ is_flag_set_v

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

Definition at line 48 of file flag_bits_v.h.

◆ is_named_v

template<typename OTHER>
bool ghassanpl::is_named_v
staticconstexpr

Definition at line 423 of file named.h.

◆ map_entire_file

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>
auto ghassanpl::set_flag_to_v
inlineconstexpr

Definition at line 72 of file flag_bits_v.h.

◆ set_flag_v

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

Definition at line 60 of file flag_bits_v.h.

◆ toggle_flag_v

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

Definition at line 68 of file flag_bits_v.h.

◆ unset_flag_v

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

Definition at line 64 of file flag_bits_v.h.