For this non-variadic example:
int Func1();
double Func2();
void MyFunc( int, double );
int main()
{
MyFunc( Func1(), Func2() );
//...
}
it's not specified whether Func1()
or Func2()
is computed first, just that both must be done before MyFunc()
is called.
How does this sequencing work with the expansion of variadic arguments?
template < typename Func, typename ...Args >
void MyFunc2( Func &&f, Args&& ...a )
{
int b[] = { f( std::forward<Args>(a) )... };
//...
}
Let's say that f
is a function object that changes its state after its first call. Will f
be called in order for each segment of a
? In other words, will f
be called on the first item in a
's list, then the second item, the third, etc., instead of randomly skipping through the expanded list? Is there what we used to call sequence points between each item?