2

我想知道初始化列表中给出的函数调用的执行顺序:

#include <iostream>

class ExpandWithConstructor
{
    public:
        template < typename ... T>
            ExpandWithConstructor( T... args) {}
};

    template < typename T>
T Print( T t )
{
    std::cout << t << std::endl;
    return t;
}

int main()
{
    ExpandWithConstructor{ Print(1.1),Print("Hallo"),Print('c')};
}

执行代码给出:

c
Hallo
1.1

问:标准中是否定义了函数的相反顺序,或者没有顺序保证?

我使用 g++ 4.8.1。

4

0 回答 0