Sobrecarga de C ++ pelo tipo de contagem de parametros do functor

Eu estou trabalhando na biblioteca "LINQ to Objects" para C ++ 11. Eu gostaria de fazer algo assim:

<code>// filtering elements by their value
arr.where( [](double d){ return d < 0; } )

// filtering elements by their value and position
arr.where( [](double d, int i){ return i%2==0; } )
</code>

Eu quero escreverarr.where_i( ... ) - é feio. Então eu preciso de sobrecarga de função / método por tipo lambda ...

Esta é minha solução:

<code>template<typename F>
auto my_magic_func(F f) -> decltype(f(1))
{
    return f(1);
}

template<typename F>
auto my_magic_func(F f, void * fake = NULL) -> decltype(f(2,3))
{
    return f(2,3);
}

int main()
{
    auto x1 = my_magic_func([](int a){ return a+100; });
    auto x2 = my_magic_func([](int a, int b){ return a*b; });
    // x1 == 1+100
    // x2 == 2*3
}
</code>

É a solução SFINAE? O que você pode me sugerir?

questionAnswers(2)

yourAnswerToTheQuestion