使用模板学习C ++ [英] Learning C++ using a template

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

问题描述

您是否建议使用模板学习C ++?



编辑

我有基本的编程语言知道如何使用循环,数组,类和函数),我已经建议在一个已经为创建游戏的模板中的教程。



解决方案

您的问题的简短回答是。 / p>

更长的答案是是,BUT ,您需要考虑何时进入C ++模板世界。 C ++是一个非常丰富的languare,带来巨大的力量和可能性。要使用这种力量,需要有责任,必须有明智地使用事物的知识。有很多事情需要在C ++中理解,以便编写好的代码和模板不在最重要的事情的列表。



但是,如已经提到的 STL (标准模板库)在某种程度上是C ++中的中心部分,正如您从名称中看到的,使用模板的库(大量)。在我看来,STL是你应该开始看你什么时候开始学习C ++ 。为此,您将需要了解有关模板的基本概念。 boost也是这样,这是C ++模板编程的杰作。在这里,您可能需要更深入地了解什么是模板,它们是什么样子以及他们做什么。



我的建议不涉及模板的C ++基础。这本身就是一个大领域,需要很长时间才能掌握。当你感到舒适的时候,看看STL,也许以后提振。在这里,您可以熟悉模板编程作为您的代码中的模板的用户。同样,这些库很大,需要工作才能正确理解,所以您可以在自己的代码中明智地使用它们。



这里是一篇关于编程的好文章,以及学习东西所需要的东西。 C ++不是一个例外,需要大量的时间和工作。



我自己的C ++经验很快10年了,我还有很多要学习,特别是关于模板。我每天使用它们,但总是试图看看他们实际使用sence。我现在不是说使用STL或boost,因为这是我相信是我的C ++基础工具包的一部分。我说的是写我自己的模板代码。我看到我工作的地方是,人们很多时候都有模板和制作良好的软件的问题。在我看来,只有主人才知道什么时候处于模板世界,何时不在以及如何结合两个



模板非常有用,我相信所有的C ++程序员都应该对它们有一些了解。这种程度的理解取决于他们自己使用的模板,随着时间的推移,你将自己决定你使用C ++的巨大的工具包。



C ++模板 - 完整指南被认为是关于模板的书,绝对值得一读(或许多;))。


Do you recommend learning C++ using a template?

Edit
I have basic programming language (I know how to work with things like loops, arrays, classes and functions) and I have been recommended to follow tutorials in a template that is already made for creating games.

I would like to become a game programmer.

解决方案

The short answer to your question is yes.

The longer answer is yes, BUT you need to consider when to move into the C++ template world. C++ is a very rich languare and comes with enormous power and possibilities. To use this power one needs responsibility and one must have the knowledge to use things wisely. There are many things one needs to understand in C++ in order to write good code and templates is not in the list of most important things.

However, as already mentioned STL (Standard Template Library) is somewhat a central piece in C++ and is, as you see from the name, a library using templates (heavily). In my opinion, STL is something you should start looking at when you start learning C++. For this you will need to understand basic concepts about templates. The same goes for boost, which is a masterpiece in C++ template programming. Here you might need even more understanding what templates are, what they look like and what they do.

My advice is to start by learning the C++ fundamentals without involving templates. This is by itself a big domain and will take a long time to master. When you feel comfortable here, take a look at STL and maybe later boost. Here you can get familiar with template programming as a user of templates in your code. Again, these libraries are big and require work to understand properly so you can use them wisely in your own code.

Here is a nice article about programming in general and what it takes to learn something. C++ is not an exception and requires a lot of time and work.

My own experience in C++ is soon 10 years and I still have a lot to learn, especially about templates. I use them daily, but always try to see when they actually make sence to use. I'm not now talking about using STL or boost, because this I believe is part of my C++ base toolkit. I'm talking about writing my own templated code. What I have seen where I've worked is that people many times have problems with templates and making good software. In my opinion, only a master knows when to be in the template world, when not to and how to combine the two.

Still, templates are very useful and I believe all C++ programmers should have some understanding of them. That level of understanding depends on their own usage of templates and over time you will yourself decide what you use from C++'s huge toolkit.

C++ templates - The Complete Guide is considered the book about templates and is definitely worth a read (or many;)).

这篇关于使用模板学习C ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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