|
cxxomfort
rel.20210622
Simple backports for C++ - http://ryan.gulix.cl/fossil.cgi/cxxomfort/
|
Namespace of the cxxomfort library.
More...
Namespaces | |
| cxxostd | |
| Backports made available by cxxomfort. | |
| fix | |
| Fixes for implementation issues in std. | |
| library | |
| Supplements to backports and other utilities. Namespace that holds the library's own implementations, emulations and supplements. | |
| st_math | |
| Namespace for compile-time static (template based) arithmetic operations. | |
Classes | |
| struct | enum_sample |
| Sample enum that can be used to figure out size and signedness of enums at compiletime. More... | |
| struct | info |
| struct | noop_t |
| noop function More... | |
| struct | OpaqueNative |
| Wraps and tags a native C type as an opaque type. More... | |
| class | outp |
| denotes a reference used as an output argument to a function. More... | |
| struct | piecewise_construct_t |
Tag indicator for piecewise construction in pair . More... | |
| struct | prio |
| priority tag struct, for ordering of function specializations. More... | |
| struct | rvoid |
regular void This is basically a "null type": it can only be default-constructed and copy-constructed, it does not hold a value, and it can be returned from functions. More... | |
| struct | tm_date |
A storage-only class to store the date component of a struct std::tm . More... | |
| struct | tm_time |
A storage-only class to store the time component of a struct std::tm . More... | |
Typedefs | |
| typedef tinyint_< signed char > | tinyint |
Numeric type that models a 1-byte signed int (like int8_t ). | |
| typedef tinyint_< unsigned char > | tinyuint |
Numeric type that models a 1-byte unsigned int (like uint8_t ). | |
Functions | |
| template<class IIt , class OIt > | |
| OIt | move (IIt ini, IIt fin, OIt dest) |
| Move-assigns the objects from sequence [ini,fin) to sequence at dest . More... | |
| template<class IIt , class OIt > | |
| OIt | move_backward (IIt ini, IIt fin, OIt dest) |
| Move-assigns the objects from sequence [ini,fin) to sequence at dest , in reverse order. More... | |
| static void | output_info (std::FILE *const ff=stdout) |
| Outputs information about cxxomfort configuration. | |
| static std::tm | to_tm (tm_time t, tm_date d) |
Composes a std::tm with information from a storage time and a storage date. More... | |
| template<typename T > | |
| CXXO_CONSTEXPR T | min (constexpr_t, T a, T b) CXXO_NOEXCEPTNOTHROW |
constexpr variant of min() | |
| template<typename T > | |
| CXXO_CONSTEXPR T | max (constexpr_t, T a, T b) CXXO_NOEXCEPTNOTHROW |
constexpr variant of max() | |
| bool | bool_once (bool &flag) CXXO_NOEXCEPTNOTHROW |
Evaluates a bool variable and "unchecks" it, returnnig its old value. More... | |
| template<typename T > | |
| T const * | coalesce_ptrs (T *... ptrs) noexcept |
| Examines a series of pointers and returns the value in the first non-NULL element among them. More... | |
| template<typename Iter > | |
| Iter | coalesce (Iter ini, Iter fin) CXXO_NOEXCEPTNOTHROW |
| Coalesces a sequence, returning the first non-NULL element, or the last element. More... | |
| template<typename T , typename... Args> | |
| std::array< T, sizeof...(Args)> | make_array (Args...&&args) |
Makes a std::array from an argument list. More... | |
| static CXXO_CONSTEXPR bool | operator== (rvoid const, rvoid const) CXXO_NOEXCEPT |
All instances of rvoid compare equal: | |
| static CXXO_CONSTEXPR bool | operator!= (rvoid const, rvoid const) CXXO_NOEXCEPT |
All instances of rvoid compare equal: | |
| template<typename A , typename B > | |
| pair< A, B > | make_pair (A const &a, B const &b) |
| make_pair idiom | |
| template<typename C > | |
| C::const_reference | at_or (C const &cont, typename C::size_type ind, typename C::const_reference alt) CXXO_NOEXCEPTNOTHROW |
| Accesses the ind -th element of cont if it exists, else alt . More... | |
| template<typename C > | |
| C::reference | at_or (C &cont, typename C::size_type ind, typename C::reference alt) CXXO_NOEXCEPTNOTHROW |
| at_or | |
| template<typename C > | |
| C::value_type const & | atindex_or (C const &cont, typename C::size_type ind, typename C::const_reference alt) CXXO_NOEXCEPTNOTHROW |
| Accesses the ind -th element of cont if it exists, else alt . More... | |
Variables | |
| static constexpr rvoid | None = {} |
Generic "keyword" for designating the None_t value. | |
| const noop_t | noop |
| noop functor - when evaluated with arguments, it does nothing | |
Namespace of the cxxomfort library.
Helper utilities to work with tuples.
Interfaces defined here:
is_tuple tuple_index tuple_unshift_type , tuple_unshift doc} "../impl/p0792r0-function_ref.hpp"
doc} "impl/p0040-memory_management.hpp"
"../impl/n3334-array_ref.hpp"}
| OIt cxxomfort::move | ( | IIt | ini, |
| IIt | fin, | ||
| OIt | dest | ||
| ) |
Move-assigns the objects from sequence [ini,fin) to sequence at dest .
Referenced by cxxomfort::cxxostd::exchange(), cxxomfort::detail::explicit_cast(), move_backward(), unique_ptr< T, D >::operator=(), and unique_ptr< T, D >::unique_ptr().
| OIt cxxomfort::move_backward | ( | IIt | ini, |
| IIt | fin, | ||
| OIt | dest | ||
| ) |
Move-assigns the objects from sequence [ini,fin) to sequence at dest , in reverse order.
Composes a std::tm with information from a storage time and a storage date.
struct tm object. | bool cxxomfort::bool_once | ( | bool & | flag | ) |
Evaluates a bool variable and "unchecks" it, returnnig its old value.
| flag | A writable bool type value. |
| Never | throws. |
The use case is such as performing repetitive tasks eg.: inside a loop, but where the very first iteration of the loop has a different, added code path:
See also std::exchange().
|
noexcept |
Examines a series of pointers and returns the value in the first non-NULL element among them.
| p1,p2,... | A list of pointers to T . |
| Never | throws. |
The function is variadic in C++≥11; in versions before it can take up to 5 arguments.
The funcion is noexcept in C++≥11, and marked throw() in versions before if the compiler supports it.
| Iter cxxomfort::coalesce | ( | Iter | ini, |
| Iter | fin | ||
| ) |
Coalesces a sequence, returning the first non-NULL element, or the last element.
| ini,fin | Iterators working as pointer-like elements. |
| Never | throws. |
The function assumes pointer-like interface for the iterator type and thus never throws (is marked noexcept for C++≥11). Attempting to use it with an iterator type that can throw on dereference is unsupported.
| std::array<T, sizeof...(Args)> cxxomfort::make_array | ( | Args...&& | args | ) |
Makes a std::array from an argument list.
| args... | The list of elements that goes into the array. |
| T | The element type (value_type ) of the returned array . |
make_array() creates a std::array given an argument list and a type to which the arguments are converted for placing them in the array. The array returned has a size equal to the number of arguments passed.
The function takes one template parameter T , which is the element type of the returned array. Starting with C++11, if the type given here is void , the type of the array will be automatically deduced if possible as per std::common_type. Pre-C++11, the type T must be given explicitly.
| C::const_reference cxxomfort::at_or | ( | C const & | cont, |
| typename C::size_type | ind, | ||
| typename C::const_reference | alt | ||
| ) |
Accesses the ind -th element of cont if it exists, else alt .
| cont | A container or container-like object supporting member .at() . |
| ind | An index. |
| alt | An alternative return value if a suitable element in cont is not found. |
| noexcept | Never throws. |
This function encapsulates the idiom of accessing the i-th element of C, or a suitable default A if no i-th element is found. Such an idiom already exists for other components in the form of eg.: variant/optional get_if<I>().
at_or() is marked noexcept . It is intended to never throw, as it checks the precondition to access the element in C 's .at() before accessing. No practical implementation of .size() or relational operators could be thought that throws, so this is safe to do.
| C::value_type const& cxxomfort::atindex_or | ( | C const & | cont, |
| typename C::size_type | ind, | ||
| typename C::const_reference | alt | ||
| ) |
Accesses the ind -th element of cont if it exists, else alt .
| cont | A container or container-like object supporting member .at() . |
| ind | An index. |
| alt | An alternative return value if a suitable element in cont is not found. |
| noexcept | Never throws. |
This function encapsulates the idiom of accessing the i-th element of C, or a suitable default A if no i-th element is found. Such an idiom already exists for other components in the form of eg.: variant/optional get_if<I>().
atindex_or() is similar to at_or() in all respects but one, including being marked noexcept ; the one difference being that access is performed via member .operator[](); as such, if that access does not exist for cont , compilation fails.
1.8.13