c++ - Language feature to apply function to each element of a parameter pack -
does know, if there exists standards proposal c++ language feature allow me replace (thanks yakk):
template<class... args> void bar(const args& ... args) { auto t = { (foo(args),0)... }; (void) t; //<- prevent warning unused variable }
with more natural this:
template<class... args> void bar(const args& ... args) { foo(args)...; }
foo
being e.g. function, function template and/or overloaded set of those, return type might void (or in general don't care about).
btw, if knows more concise way write in c++14, feel free share, think, handled in this question
use fold expression comma operator:
( void(foo(args)) , ...);
i didn't see proposal change further in recent mailings.
Comments
Post a Comment