Does std::apply provide a guarantee for order of evaluation?

Viewed 272

In c++, the order of evaluation of expressions provided as parameters for a function call is not specified. When I use std::apply is there a guarantee that the function is called IN ORDER on the elements of the tuple? I have a case where it matters that the function is first applied to the first element of the tuple, then the second, then the third, ....

As a counter example:

template <class Tuple, size_t... Is>
void function(Tuple t, std::index_sequence<Is...>) {
    some_func( my_func(get<Is>(t))... );
}

will not guarantee the order that my_func is called on each element of the tuple.

2 Answers
Related