本文介绍了我最喜欢C ++的东西的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我是否可以使用我的语言理想来近似。在翻转 方面,我最不喜欢的是用这种方式获得的所有 flak / protect-the-golden-calf。 我认为很多模板讨论就像谈论.net或 类似,并且脑力随着进步而浪费。对于 实例,当我看到问题解决方案中给出的示例然后我看到代码是基于模板的 时,我忽略它。 我对模板如何打击我有一个很好的类比(阅读, 模板的味道):还记得Indy赛车是否有涡轮增压?是的,所有 的开发都是用涡轮增压而不是发动机。我认为模板是对B ++有类似影响的。给我精心设计的自然吸气 而不是 爆炸/产热/背压产生/复杂性介绍 turbos any一天! JohnIs that I can approximate using my ideal of a language in it. On the flipside, what I dislike most about it is all theflak/protecting-the-golden-calf one gets when using it that way.I think a lot of the template discussions are like talking about .net orsimilar and that brain power is being wasted along with progress. Forinstance, when I see examples given in solution of a problem and then I seethat the code is template-based, I ignore it.I have a good analogy of how templates strike me (read, "the flavor oftemplates"): Remember when Indy car racing was turbo charged? Yeah, all thedevelopment was going into turbos instead of engines. I think templates arehaving similar effect on C++. Give me well-designed naturally aspiratedinstead ofexploding/heat-producing/back-pressure-producing/complexity-introducingturbos any day!John推荐答案 使用它对你有用的任何方式。请记住,现代的 编程范例是为了鼓励代码轻松地被其他人支持并且可以重复使用。Use it whatever way works for YOU. Just keep in mind that modernprogramming paradigms are suppose to encourage code being easilysupported by others and being reusable. 只是我的拙见,但如果你忽略基于模板的代码 那么你还没有完全理解语言的力量。Just my humble opinion, but if you ignore template based code out of handthen you are not fully appreciating the strength of the language. 香草,因为它们应该是...Vanilla, as they should be... 如果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 besix or seven times as large as it needs to be because of all the customoperations 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 toimplement each of the above for each specific data type I wanted tocollect. Not to mention, string is itself a template class. Are yousaying that you won''t use the string class because it is implemented usingtemplates?This is stuff that colleges should be giving students an appreciationfor. If they aren''t then the schools are not doing their job.My appologies to the regulars for not resisting feeding of the trolls. :^) 你的巨魔变得乏味。 - Ian Collins。Your trolls are becoming tedious.--Ian Collins. 没有人强迫你模仿任何东西或所有东西。 我失败了看看你发现什么turbo-ish关于模板。它们相对简单,而且只需很少的努力就可以获得许多红利。 从头开始重新设计汽车是没有意义的因为 你改变了燃料或比赛有新的规格。这是愚蠢的。 轮子是一个轮子,无论是铝还是其他合金, 它还是一个轮子。 如果设计发生变化,它仍然是一个轮子。 如果它的轮廓发生变化,它仍然是一个轮子。 现在假设你有100种材料,10种轮廓和700 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 arerelatively simple and a tiny effort affords you many, many dividends.It just doesn''t make sense to redesign a car from scratch just causeyou 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 700designs...Is your arguement that the effort of writing 700,000 wheel structuresdoesn''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 ++的东西的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-21 16:19