开发者

Does c++0x tuple use the new variadic templates or Boost's macro-fied tuple implementation?

I read it was based on Boost's version, but I wasn't quite sure what that meant when it came down 开发者_运维知识库to implementation. I know Boost does their own variadic template, but I would assume c++0x would use its own variadic templates for the new tuple.


The tuple in the C++0x draft standard uses C++0x variadic templates. It is declared as (§20.4.1):

template <class... Types> class tuple;

Note, however, that the TR1 language extensions also include tuple, which does not use variadic templates, since there was no such thing when TR1 was written. In TR1, tuple is declared as (§6.1):

template <class T1 = unspecified ,
          class T2 = unspecified ,
          ...,
          class TM = unspecified > class tuple;

where M is some implementation-defined value that should be at least ten.

TR1 isn't formally a part of the C++ language, but many recent implementations support it. If you have an implementation that doesn't yet support variadic templates, it might support the TR1 tuple.

You can download the latest draft standard, the Final Committee Draft (10.5 MB PDF link).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜