Function-Tools: include lambdas into the investigation

...and move the tail-call of the template instantiation into try.cpp


This experiment clearly shows the discrepancy now:
 - binding a member pointer directly into a function object will expand the argument list
 - but binding a similar lambda into a function object won't
   (it is not necessary due to the context capture)

The result is that we need to drop support for one of those cases,
and it is clear that the member poiter will be the looser...
This commit is contained in:
Fischlurch 2017-03-19 00:19:07 +01:00
parent c5bff75bc2
commit 0b7559ce9a
2 changed files with 49 additions and 2 deletions

View file

@ -59,6 +59,46 @@ using std::bind;
using std::string;
using std::tuple;
////////////////############# Investigation of implementation variants
namespace lib {
namespace meta {
template< typename RET, class CLASS
, typename A1
>
struct _Fun<RET (CLASS::*) (A1) >
{
typedef RET Ret;
typedef Types<CLASS* const, A1> Args;
typedef RET Sig(CLASS* const, A1);
};
template< typename RET, class CLASS
, typename A1
>
struct _Fun<RET (CLASS::*) (A1) const>
{
typedef RET Ret;
typedef Types<CLASS* const, A1> Args;
typedef RET Sig(CLASS* const, A1);
};
template< typename RET, class CLASS
, typename A1
, typename A2
>
struct _Fun<RET (CLASS::*) (A1,A2) const>
{
typedef RET Ret;
typedef Types<CLASS* const, A1,A2> Args;
typedef RET Sig(CLASS* const, A1,A2);
};
}}//namespace lib::meta
////////////////############# Investigation of implementation variants
int
funny (uint i)
{
@ -128,12 +168,19 @@ main (int, char**)
Fun f6{bind (f5, funk, _1)};
auto lambda = [&](uint ii) { return funk.fun(ii); };
showType (funny);
showType (&funny);
showType (Funky::notfunny);
showType (memfunP);
showType (lambda);
cout << "\n\n-------\n";
SHOW_TYPE (decltype(&Funky::operator()));
SHOW_TYPE (decltype(lambda));
cout << "\n.gulp.\n";

View file

@ -262,7 +262,7 @@ namespace meta{
};
/** Specialisations for member function pointers */
template<typename RET, class CLASS>
/* template<typename RET, class CLASS>
struct _Fun<RET (CLASS::*) (void) >
{
typedef RET Ret;
@ -376,7 +376,7 @@ namespace meta{
typedef Types<CLASS* const, A1,A2,A3,A4,A5,A6,A7,A8> Args;
typedef RET Sig(CLASS* const, A1,A2,A3,A4,A5,A6,A7,A8);
};
*/
template<typename FUN>