dot-xx
A personal collection of small C++ modules
Loading...
Searching...
No Matches
dxx.utils Module Reference

Miscellaneous stuff that is useful but too small/unimportant to be put in its own module. More...

Concepts

concept  dxx::utils::pointer
 Concept over std::is_pointer_v.
concept  dxx::utils::reference
 Concept over std::is_reference_v.
concept  dxx::utils::const_vrp
 A const value, a pointer to const, or a reference to const.
concept  dxx::utils::mut_vrp
 Inverse of const_vrp.
concept  dxx::utils::is_a
 Checks if the type is an instance of a template.
concept  dxx::utils::either_of
 Checks if a type is the same as at least one of the provided arguments.
concept  dxx::utils::neither_of
 Checks if a type is neither of provided arguments.
concept  dxx::utils::declares
 Checks if the type was used to declare a certain value.

Classes

class  dxx::utils::FileDescriptor
 RAII file descriptor. Wraps an integer file descriptor and defers closing it to the desctructor. More...
class  dxx::utils::heap::Option< T >
 An std::optional replacement with heap-allocated storage. More...
class  dxx::utils::Defer< TDeferred >
 Class for deferring operations until the end of lifetime. More...

Functions

template<typename T, std::three_way_comparable_with< T > U>
constexpr std::compare_three_way_result_t< T, U > dxx::utils::heap::operator<=> (const Option< T > &lhs, const Option< U > &rhs)
template<typename T>
constexpr std::compare_three_way_result_t< bool, bool > dxx::utils::heap::operator<=> (const Option< T > &lhs, std::nullopt_t)
template<typename T, typename U>
constexpr std::compare_three_way_result_t< T, U > dxx::utils::heap::operator<=> (const Option< T > &lhs, const U &rhs)
template<typename T, std::equality_comparable_with< T > U>
constexpr bool dxx::utils::heap::operator== (const Option< T > &lhs, const Option< U > &rhs)
template<typename T, std::equality_comparable_with< T > U>
constexpr bool dxx::utils::heap::operator== (const Option< T > &lhs, const U &rhs)
template<typename T>
constexpr bool dxx::utils::heap::operator== (const Option< T > &lhs, std::nullopt_t)
template<typename T>
constexpr void std::swap (dxx::utils::heap::Option< T > &lhs, dxx::utils::heap::Option< T > &rhs) noexcept
template<typename Integer>
constexpr auto dxx::utils::range (const Integer &to)
 Python-like range function ([ 0, to )).
template<typename From, std::convertible_to< From > To>
constexpr auto dxx::utils::range (const From &from, const To &to)
 Python-like range function ([ from, to )).
template<typename From, std::convertible_to< From > To, std::convertible_to< From > Step>
constexpr auto dxx::utils::range (const From &from, const To &to, const Step &step)
 Python-like range function ([ from, to ) with step step).

Variables

template<typename T, typename... Ts>
constexpr std::optional< std::size_t > dxx::utils::find_type_in = FindTypeIn<0, T, Ts...>::value
 Find the type T in the list of types Ts, return its index if present, otherwise is std::nullopt.
template<template< typename... > typename Range>
constexpr As< Range > dxx::utils::as {}
 An adaptor-like shortcut to invoking an std::from_range constructor for a class template.

Detailed Description

Miscellaneous stuff that is useful but too small/unimportant to be put in its own module.

Files

file  /build-llvm-libcpp/_deps/dot-xx-utils-src/src/utils.xx
 The main interface file of the dxx::utils module.
file  /build-llvm-libcpp/_deps/dot-xx-utils-src/src/defer.xx
 A simple RAII wrapper to run stuff at the end of scope.
file  /build-llvm-libcpp/_deps/dot-xx-utils-src/src/file_descriptor.xx
file  /build-llvm-libcpp/_deps/dot-xx-utils-src/src/meta.xx
 Metaprogramming stuff.
file  /build-llvm-libcpp/_deps/dot-xx-utils-src/src/option.xx
 Heap-allocated optional type.
file  /build-llvm-libcpp/_deps/dot-xx-utils-src/src/ranges.xx
 Utility code that helps working with ranges.
file  /build-llvm-libcpp/_deps/dot-xx-utils-src/src/traits.xx
 Type traits and concepts.