xo-callback xo-alloc: + GC copy callbacks + unique_ptr cbset support
This commit is contained in:
parent
746dc4b0e2
commit
4eae80295a
7 changed files with 405 additions and 285 deletions
34
xo-callback/include/xo/callback/UpCallbackSet.hpp
Normal file
34
xo-callback/include/xo/callback/UpCallbackSet.hpp
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/* @file UpCallbackSet.hpp
|
||||
*
|
||||
* author: Roland Conybeare, Aug 2025
|
||||
*/
|
||||
|
||||
#include "CallbackSetImpl.hpp"
|
||||
#include "callback_concept.hpp"
|
||||
#include <memory>
|
||||
|
||||
namespace xo {
|
||||
namespace fn {
|
||||
template <typename NativeFn>
|
||||
using UpCallbackSet = CallbackSetImpl<std::unique_ptr<NativeFn>>;
|
||||
|
||||
template <typename NativeFn, typename MemberFn>
|
||||
requires(callback_concept<NativeFn>)
|
||||
class UpNotifyCallbackSet : public UpCallbackSet<NativeFn> {
|
||||
public:
|
||||
explicit UpNotifyCallbackSet(MemberFn fn)
|
||||
: privileged_member_fn_{fn} {}
|
||||
|
||||
template <typename... Tn>
|
||||
void operator()(Tn&&... args) {
|
||||
this->invoke(this->privileged_member_fn_, args...);
|
||||
}
|
||||
|
||||
private:
|
||||
/** implements UpNotifyCallbackSet's call operator **/
|
||||
MemberFn privileged_member_fn_;
|
||||
};
|
||||
} /*namespace fn*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end UpCallbackSet.hpp */
|
||||
Loading…
Add table
Add a link
Reference in a new issue