Mam zmiennej liczbie argumentów funkcji takich jak:aliasing do zmiennej liczbie argumentów funkcji szablonu
void test(int){}
template<typename T,typename...Args>
void test(int& sum,T v,Args... args)
{
sum+=v;
test(sum,args...);
}
Chcę aliasu go do czegoś podobnego:
auto sum = test;//error : can not deduce auto from test
int main()
{
int res=0;
test(res,4,7);
std::cout<<res;
}
Próbowałem przy użyciu std::bind
ale to nie działa ze zmiennej liczbie argumentów Funkcjonuje, ponieważ potrzebuje obiektów zastępczych ...
Czy możliwe jest alias funkcji variadic?
'auto sumę = [] (automatycznie && ... s) {powrotu test (std :: forward (pp) ...); }; 'lub coś podobnego. To nie jest prawdziwy pseudonim; na przykład nie można użyć 'auto x = & sum ;'. –
dyp