cxxomfort
rel.20210622
Simple backports for C++ - http://ryan.gulix.cl/fossil.cgi/cxxomfort/
|
Backports related to Standard header <functional>
Interfaces defined in this section:
bit_and
, bit_or
, bit_xor
(C++03, only for some cases).not_fn()
(C++17) - generalically negate any functor.invoke
() / invoke_r
() (C++17), callable invocation , 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 wrapperThe 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 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.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).invoke(callable, args...)
invoke(callable, args...)
"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.