MeshLib Documentation
Loading...
Searching...
No Matches
MRMakeSlot.h
Go to the documentation of this file.
1#pragma once
2
3#include <type_traits>
4
5template<typename MemberFuncPtr, typename BaseClass>
6auto bindSlotCallback( BaseClass* base, MemberFuncPtr func )
7{
8 static_assert( !( std::is_move_assignable_v<BaseClass> || std::is_move_constructible_v<BaseClass> ),
9 "MAKE_SLOT requires a non-movable type" );
10 return[base, func] ( auto&&... args )
11 {
12 return ( base->*func )( std::forward<decltype( args )>( args )... );
13 };
14}
15
16// you will not be able to move your struct after using this macro
17#define MAKE_SLOT(func) bindSlotCallback(this,func)
auto bindSlotCallback(BaseClass *base, MemberFuncPtr func)
Definition MRMakeSlot.h:6