我最喜欢C ++的东西 [英] What I like most about C++

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

问题描述

我是否可以使用我的语言理想来近似。在翻转

方面,我最不喜欢的是用这种方式获得的所有

flak / protect-the-golden-calf。


我认为很多模板讨论就像谈论.net或

类似,并且脑力随着进步而浪费。对于

实例,当我看到问题解决方案中给出的示例然后我看到代码是基于模板的

时,我忽略它。


我对模板如何打击我有一个很好的类比(阅读,

模板的味道):还记得Indy赛车是否有涡轮增压?是的,所有

的开发都是用涡轮增压而不是发动机。我认为模板是对B ++有类似影响的
。给我精心设计的自然吸气

而不是

爆炸/产热/背压产生/复杂性介绍

turbos any一天!


John

Is that I can approximate using my ideal of a language in it. On the flip
side, what I dislike most about it is all the
flak/protecting-the-golden-calf one gets when using it that way.

I think a lot of the template discussions are like talking about .net or
similar and that brain power is being wasted along with progress. For
instance, when I see examples given in solution of a problem and then I see
that the code is template-based, I ignore it.

I have a good analogy of how templates strike me (read, "the flavor of
templates"): Remember when Indy car racing was turbo charged? Yeah, all the
development was going into turbos instead of engines. I think templates are
having similar effect on C++. Give me well-designed naturally aspirated
instead of
exploding/heat-producing/back-pressure-producing/complexity-introducing
turbos any day!

John

推荐答案

2007年5月24日星期四03:56:16 +0000, Noone写道:
On Thu, 24 May 2007 03:56:16 +0000, Noone wrote:

我可以使用我的语言理想来近似。在

翻转方面,我最不喜欢的是所有的

flak / protect-the-golden-calf以这种方式使用它。
Is that I can approximate using my ideal of a language in it. On the
flip side, what I dislike most about it is all the
flak/protecting-the-golden-calf one gets when using it that way.



使用它对你有用的任何方式。请记住,现代的

编程范例是为了鼓励代码轻松地被其他人支持并且可以重复使用。

Use it whatever way works for YOU. Just keep in mind that modern
programming paradigms are suppose to encourage code being easily
supported by others and being reusable.


我认为很多模板讨论就像谈论.net或

类似,并且大脑的力量正在被浪费以及进步。对于

实例,当我看到问题解决方案中给出的示例然后我看到代码是基于模板的时候,我忽略了它。
I think a lot of the template discussions are like talking about .net or
similar and that brain power is being wasted along with progress. For
instance, when I see examples given in solution of a problem and then I
see that the code is template-based, I ignore it.



只是我的拙见,但如果你忽略基于模板的代码

那么你还没有完全理解语言的力量。

Just my humble opinion, but if you ignore template based code out of hand
then you are not fully appreciating the strength of the language.


我对模板如何打击我有一个很好的类比(阅读,

模板的味道) :
I have a good analogy of how templates strike me (read, "the flavor of
templates"):



香草,因为它们应该是...

Vanilla, as they should be...


记得当Indy汽车赛车被涡轮增压?是的,所有

开发进入涡轮机而不是发动机。我认为

模板对C ++有类似的影响。给我精心设计的

自然吸气而不是

爆炸/产热/背压产生/复杂性介绍

turbos any天!
Remember when Indy car racing was turbo charged? Yeah, all
the development was going into turbos instead of engines. I think
templates are having similar effect on C++. Give me well-designed
naturally aspirated instead of
exploding/heat-producing/back-pressure-producing/complexity-introducing
turbos any day!



如果c ++没有模板功能那么我当前的项目将是b / b
所需的六到七倍由于所有自定义

操作,我必须重新实现特定数据类型。


stack< stringstack_of_strings;

vector< floatsome_floats;

class my_class;

map< int,my_classmy_map;


现在想想我保存的所有代码而不是必须

为我想要的每个特定数据类型实现上述每一项

collect。更不用说,string本身就是一个模板类。你是否因为使用

模板来实现你不会使用字符串类吗?

这是
这是大学应该给予学生欣赏的东西

for。如果他们不是,那么学校就没有做好自己的工作。

我向常客们表示他们不会拒绝喂养巨魔。 :^)

If c++ didn''t have template capabilities then my current project would be
six or seven times as large as it needs to be because of all the custom
operations I would have to reimplement for specific data types.

stack<stringstack_of_strings;
vector<floatsome_floats;
class my_class;
map<int, my_classmy_map;

Now think about all the code writing I saved instead of having to
implement each of the above for each specific data type I wanted to
collect. Not to mention, string is itself a template class. Are you
saying that you won''t use the string class because it is implemented using
templates?

This is stuff that colleges should be giving students an appreciation
for. If they aren''t then the schools are not doing their job.
My appologies to the regulars for not resisting feeding of the trolls. :^)


JohnQ写道:
JohnQ wrote:

我可以使用我的语言理想来近似。在翻转

方面,我最不喜欢的是用这种方式获得的所有

flak / protect-the-golden-calf。
Is that I can approximate using my ideal of a language in it. On the flip
side, what I dislike most about it is all the
flak/protecting-the-golden-calf one gets when using it that way.



你的巨魔变得乏味。


-

Ian Collins。

Your trolls are becoming tedious.

--
Ian Collins.


5月23日晚上11:56,JohnQ < johnqREMOVETHISprogram ... @ yahoo.com>

写道:
On May 23, 11:56 pm, "JohnQ" <johnqREMOVETHISprogram...@yahoo.com>
wrote:

是否可以使用我的理想语言来估算它。在翻转

方面,我最不喜欢的是用这种方式获得的所有

flak / protect-the-golden-calf。


我认为很多模板讨论就像谈论.net或

类似,并且脑力随着进步而浪费。对于

实例,当我看到问题解决方案中给出的示例然后我看到代码是基于模板的

时,我忽略它。


我对模板如何打击我有一个很好的类比(阅读,

模板的味道):还记得Indy赛车是否有涡轮增压?是的,所有

的开发都是用涡轮增压而不是发动机。我认为模板是对B ++有类似影响的
。给我精心设计的自然吸气

而不是

爆炸/产热/背压产生/复杂性介绍

turbos any一天!


John
Is that I can approximate using my ideal of a language in it. On the flip
side, what I dislike most about it is all the
flak/protecting-the-golden-calf one gets when using it that way.

I think a lot of the template discussions are like talking about .net or
similar and that brain power is being wasted along with progress. For
instance, when I see examples given in solution of a problem and then I see
that the code is template-based, I ignore it.

I have a good analogy of how templates strike me (read, "the flavor of
templates"): Remember when Indy car racing was turbo charged? Yeah, all the
development was going into turbos instead of engines. I think templates are
having similar effect on C++. Give me well-designed naturally aspirated
instead of
exploding/heat-producing/back-pressure-producing/complexity-introducing
turbos any day!

John



没有人强迫你模仿任何东西或所有东西。

我失败了看看你发现什么turbo-ish关于模板。它们相对简单,而且只需很少的努力就可以获得许多红利。

从头开始重新设计汽车是没有意义的因为

你改变了燃料或比赛有新的规格。这是愚蠢的。


轮子是一个轮子,无论是铝还是其他合金,

它还是一个轮子。

如果设计发生变化,它仍然是一个轮子。

如果它的轮廓发生变化,它仍然是一个轮子。

现在假设你有100种材料,10种轮廓和700 < br $> b $ b设计...


你认为写700,000个车轮结构的努力

不要求模板?

明天还会添加多少材料,型材和设计?

毕竟,这就是模板的最终目标。

It适用于任何事物,包括尚不存在的东西。

Nobody forces you to templatize anything or everything.
I fail to see what you find turbo-ish about templates. They are
relatively simple and a tiny effort affords you many, many dividends.
It just doesn''t make sense to redesign a car from scratch just cause
you changed the fuel or the race has new specs. Thats folly.

A wheel is a wheel, whether aluminum or some other alloy is involved,
its still a wheel.
If the design changes, its still a wheel.
If its profile changes, its still a wheel.
Now lets suppose you have 100 materials, 10 profiles and 700
designs...

Is your arguement that the effort of writing 700,000 wheel structures
doesn''t beg for a template?
How many more materials, profiles and designs will be added tommorrow?
After all, thats the ultimate goal of a template.
It works with anything, including what doesn''t exist yet.


这篇关于我最喜欢C ++的东西的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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