元组不是按顺序构建的? [英] Tuple isn't being constructed in order?
本文介绍了元组不是按顺序构建的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
// Example program
#include <iostream>
#include <tuple>
struct X {
X(int) { std::cout << "X constructor\n"; }
};
struct Y {
Y(int) { std::cout << "Y constructor\n"; }
};
int main()
{
std::tuple<X,Y> t(1,2);
}
输出:
Y constructor
X constructor
我认为标准保证了顺序元组元素是在A,B,...,Y,Z?中构造的。
This doesn't seem correct... I thought the standard guaranteed the order tuple elements were constructed in: A, B, ..., Y, Z?
推荐答案
std :: tuple
施工顺序目前未指定。
有关其订单具体决定的提案已经提交给委员会,但在此之前不应依赖该订单。
A proposal for a concrete decision on its order has been submitted to the committee, but until then the order should not be relied on.
这篇关于元组不是按顺序构建的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文