extend lamda-signature-extracting metafunction to several arguments
This commit is contained in:
parent
2098e69981
commit
7b6713bcab
2 changed files with 22 additions and 5 deletions
|
|
@ -66,7 +66,8 @@
|
|||
virtual void
|
||||
setAttribute (ID id, Attribute& newValue)
|
||||
{
|
||||
using ValueType = typename _ClosureType<CLO>::ArgType;
|
||||
using Args = typename _ClosureType<CLO>::Args;
|
||||
using ValueType = typename lib::meta::Pick<Args, 0>::Type;
|
||||
|
||||
if (id == attribID_)
|
||||
change_(newValue.get<ValueType>());
|
||||
|
|
|
|||
|
|
@ -272,6 +272,7 @@ namespace diff{
|
|||
namespace { // Mutator-Builder decorator components...
|
||||
|
||||
using lib::meta::Strip;
|
||||
using lib::meta::Types;
|
||||
|
||||
/**
|
||||
* Type rebinding helper to pick up the actual argument type.
|
||||
|
|
@ -285,12 +286,27 @@ namespace diff{
|
|||
: _ClosureType<decltype(&FUN::operator())>
|
||||
{ };
|
||||
|
||||
template<class C, class RET, class ARG>
|
||||
struct _ClosureType<RET (C::*)(ARG) const>
|
||||
template<class C, class RET, typename...ARGS>
|
||||
struct _ClosureType<RET (C::*)(ARGS...) const>
|
||||
{
|
||||
typedef ARG ArgType;
|
||||
typedef RET ReturnType;
|
||||
using Args = typename Types<ARGS...>::Seq;
|
||||
using Ret = RET;
|
||||
using Sig = RET(ARGS...);
|
||||
};
|
||||
|
||||
template<class RET, typename...ARGS>
|
||||
struct _ClosureType<RET (*)(ARGS...)>
|
||||
{
|
||||
using Args = typename Types<ARGS...>::Seq;
|
||||
using Ret = RET;
|
||||
using Sig = RET(ARGS...);
|
||||
};
|
||||
|
||||
|
||||
template<typename FUN, typename SIG>
|
||||
struct has_Sig
|
||||
: std::is_same<SIG, typename _ClosureType<FUN>::Sig>
|
||||
{ };
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue