模板问题和主题 [英] Template questions and topics

查看:93
本文介绍了模板问题和主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Everyone,



最近,我经历了C ++的模板概念。了解下面提到的主题

A)模板及其使用的基础知识。

B)模板函数和类

C)如何定义成员函数它使用模板与内联模板功能。

D)模板专业化

F)模板的非类型参数



我在下面提到链接..

http://www.cplusplus.com/doc/tutorial/templates/



问题:

1-我还应该在模板中学到什么?还有其他重要话题吗?

2-更好的链接或参考?







问候,

Joy

Hello Everyone,

Recently, I went through template concept of C++. Learnt below mentioned topics
A) Basics of template and its use.
B) Template function and class
C) How to define member function which uses template versus Inline template function.
D) Template specialization
F) Non-type parameters for templates

I refered below link..
http://www.cplusplus.com/doc/tutorial/templates/

Questions:
1- What else I should learn in template? Is there any other important topic?
2- Any better link or reference?



Regards,
Joy

推荐答案

你没有具体提到这是否被覆盖,但超出(完整)模板专业化你还应学会使用部分模板专业化。



最近关于模板元编程编程的文章 [ ^ ]大量使用部分特化。对于C ++模板的新手来说可能很难理解,但是它提供了可以试验的优秀且有用的示例。



新的C ++ 11标准引入了新模板功能,e。 G。 可变参数模板 [ ^ ]。此外,STL在C ++ 11中获得了一些新功能,例如: G。 std :: result_of [ ^ ],它可以帮助您确定模板函数或模板化类中操作的结果类型。



要检查的其他内容将是IDE支持模板的具体信息:e。 G。我知道VisualStudio 2010不支持某些合法模板语法表达式(我特别在模板成员函数的前向声明方面遇到了一些麻烦)。当然,VS和其他IDE通常不支持最新标准的所有最新功能。对于VS,您可以在他们的网站上查看C ++ 11支持[ ^ ]
You didn't specifically mention whether this was covered, but beyond (full) Template Specialization you should also learn to use Partial Template Specialization.

There is a recent article on Template Metaprogramming Programming[^] which heavily uses partial specialization. It is probably difficult to understand for someone new to C++ Templates, but it provides great and useful examples that you can experiment with.

The new C++ 11 standard introduced new template features, e. g. variadic templates[^]. Additionally, the STL got some new functionality in C++ 11, e. g. std::result_of[^], which helps you determine the result type of an operation inside a template function or templated class.

Something else to check would be specifics on your IDEs support of templates: e. g. I know that VisualStudio 2010 doesn't support some legal template syntax expressions (I specifically had some trouble with forward declarations of template member functions). And of course VS and other IDEs don't usually support all the newest features of the most recent standard. For VS you can check on C++11 support on their site[^]


这篇关于模板问题和主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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