C ++ 0x:允许元组的元组? [英] C++0x : are tuples of tuples allowed?
问题描述
我目前正在开发一个有很多模板的类,并且能够建立元组的元组会使它更容易
但我试过这个简单MSVC ++ 2010中的代码:
#include< tuple>
void main(){
auto x = std :: make_tuple(std :: make_tuple(5,true));
}
我收到一个编译错误。如果我不使用std :: make_tuple但直接使用std :: tuple的构造函数,同样的问题发生。
这是一个MSVC的错误或元组的元组不允许标准?
谢谢
更多数据点: / p>
-
如果我们使用
std :: tr1 :: tuple
类型而不是使用auto
,那么Visual C ++ 2008编译代码没有错误。 -
如果我们使用
li>boost :: tuple
显式地声明类型,而不是使用auto
,则Visual C ++ 2008和Visual C ++ 2010都会无错编译代码。
看起来它可能是一个实现错误。
I'm currently working on a class with a lot of templates and being able to build tuples of tuples would make it a lot easier
But I tried this simple code in MSVC++ 2010:
#include <tuple>
void main() {
auto x = std::make_tuple(std::make_tuple(5, true));
}
And I get a compilation error. The same problem happens if I don't use std::make_tuple but directly std::tuple's constructor
Is it a bug of MSVC or are tuples of tuples not allowed by the standard?
Thank you
More data points:
If we use
std::tr1::tuple
and explicitly state the type instead of usingauto
, then Visual C++ 2008 compiles the code without error. Trying to compile that same code with Visual C++ 2010 results in the error you are seeing.If we use
boost::tuple
an explicitly state the type instead of usingauto
, then Visual C++ 2008 and Visual C++ 2010 both compile the code without error.
It looks like it is probably an implementation bug.
这篇关于C ++ 0x:允许元组的元组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!