Nested templates vs shift operator

隐身守侯 提交于 2019-11-29 11:01:58

MSVC++2010 supports C++0x feature Right Angle Brackets

Be careful because previously good C++03 code may break with compilers supporting this feature.

MyArray< MyArray<int, 16 >> 2>, 5 > arrayInst;

This would be the fix:

MyArray< MyArray<int, (16 >> 2)>, 5 > arrayInst;

This code works exactly what I want (map of pairs) but I supposed to get some error about >>

C++0x has fixed this. So if you're not getting any error with MSVS2010, then its no wonder, as MSVS2010 has implemented some of C++0x features.

Also, even with C++03, many compilers handle such cases, though not required by the Standard(2003).

C++0x now supports that syntax without errors. Compilers have already started to implement most of these features, so it wouldn't be surprising that the latest Microsoft C++ compiler supports it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!