cxxomfort
rel.20211024
Simple backports for C++ - https://ryan.gulix.cl/fossil.cgi/cxxomfort/
|
Backports related to Standard header <functional>
Interfaces defined in this section:
bit_and
, bit_or
, bit_xor
(C++98, only for some older compilers).mem_fn()
wrapper (C++11) (only for some compilers)not_fn()
(C++17) - generalically negate any functor.invoke()
/ invoke_r()
invocation of callables (C++17, C++20), for C++11-onward only.unwrap_reference
(C++20).bind_front()
(C++20) - for C++11-onward only.The following interfaces are repointed to namespace std:
: when found in namespace std::tr1:
: :
std::reference_wrapper
, std::ref()
, std::cref()
- object wrapper and related utilities.std::bind()
- function wrapper and related utilities.std::placeholders::_*
from _1
to _9
.std::mem_fn()
- member function adapter.std::function
- function/callable wrapperstd::hash
- generic hashingThe following interfaces are provided by cxxomfort when CXOMFORT_USE_INTERNAL_TR1
is defined:
cxxomfort::cxxostd::reference_wrapper
, std::ref()
, std::cref()
.std::placeholders::_*
from _1
to _9
.std::mem_fn()
.Non-backport interfaces (cxxomfort::fix
):
hash
- Extra-power, specializable forwarder to std::hash
.Cxxomfort implements a backport of std::invoke()
from C++17 and std::invoke_r()
from C++20 for C++11 onwards, and for certain compilers in C++03 mode. The feature is implemented and functions differently depending on the compiler and Standard mode.
invoke()
is implemented via trailing return type and should be capable of handing any callable type and any return type generated.typeof
, invoke()
is implemented via deduced return type, which could cause the callable to be invoked twice.typeof
support, invoke()
is not provided.Additionally, cxxomfort sets the SD6 macros __cpp_lib_invoke
and __cpp_lib_invoke_r
when it backports (not emulates) these facilities.
std::reference_wrapper
and related utilities to exist and function in order, as part of the general TR1 requirement.std::bind
and related utilities to exist and function in order, as part of the general TR1 requirement.bind1st()
, bind2nd()
and ptr_fun
(C++17/C++20).callable( args... )
, accounting for eg.: member-pointer callables. (R)callable( args... )
, specifying the return type. "std::reference_wrapper"
A reference_wrapper
hosts a reference to an object in the same way a normal reference does, but separates assignment mechanics so that assigning to the wrapper changes whichobject is hosted, instead of changing the object itself. It basically behaves as a pointer-to-T.