在VS2012中元组如何工作? [英] How do tuples work in VS2012 ?

查看:111
本文介绍了在VS2012中元组如何工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Visual studio 2012功能,元组,但不包括可变参数模板。

Visual studio 2012 features, tuples but not variadic templates.

如何实现元组,如何在不使用varadic模板的情况下实现元组?

How is this done, how one implements tuples without the use of varadic templates ?

推荐答案

简单来说,微软以前在.NET中实现类似tuple的数据类型,许多版本,每个都有固定数量的参数。检查.NET文档。

In a few words, Microsoft did exactly the same thing they did to implement tuple-like datatypes in .NET previously: Creating many versions, each with a fixed number of parameters. Check the .NET documentation.

这是怎么实现的,如何在不使用varadic模板的情况下实现元组请注意,Microsoft所做的是简单的方法:C ++ tuples是一个基于许多最疯狂的元编程技巧(Variadic模板相关)的图书馆功能。基于可变参数模板(即,理论无限通用元组的实现)的元组的实现是不容易的。建议您阅读这篇有趣的文章

"How is this done, how one implements tuples without the use of varadic templates" Note that what Microsoft did is the easy way: C++ tuples are a library feature based on many of the most freaking metaprogramming tricks (Variadic templates related) ever done. The implementation of tuples based on variadic-templates (i.e. the implementation of theorically-infinite generic tuples) is not easy at all. I suggest you to read this interesting article.

最后,R. Martinho Fernandes在他的博客上有一篇关于高效C ++元组实现的完整文章系列: http://flamingdangerzone.com/cxx11/2012/07/06/optimal-tuple-i.html

Finally R. Martinho Fernandes has a full article series on his blog talking about efficient C++ tuple implementation: http://flamingdangerzone.com/cxx11/2012/07/06/optimal-tuple-i.html

这篇关于在VS2012中元组如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆