STL与否? [英] To STL or not to?

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

问题描述

嘿大家,


我只是想知道这些天STL的共识是什么。


我想如果我记得好吧,好几年前,大多数人(如果不是每个人b $ b)我知道无论如何都远离它。


然后我转换到C#几年并没有太多担心,

但是今年早些时候我又回到了更多的C ++工作,我只是想知道这件事。 =)


我的一个项目确实大量使用了各种数组,我现在使用定制的类来实现这个目的而且我只是

思考潜在的STL可能是一个更好的主意。


任何想法/建议都将不胜感激,


谢谢,


-

斯蒂芬

2003雅马哈R6


??? ??????????????????????????????????????????????????????? b $ b ????????????????????????????????????? div class =h2_lin>解决方案

" Stephan Rose" < no **** @ spammer.com写了留言

新闻:p8 ************************** **** @ giganews.com ...


嘿大家,


我只是想知道普遍的共识是什么这几天是在STL上。


我想如果我记得正确,几年前,大多数人(如果不是每个人都是b $ b)我知道无论如何都待在这里远离它。


然后我转换到C#几年并且不用太担心,

但是已经切换回更多的C ++工作了今年早些时候,我只是想知道这件事。 =)


我的一个项目确实大量使用了各种数组,我现在使用定制的类来实现这个目的而且我只是

思考潜在的STL是否是一个更好的主意。


任何想法/建议都会受到赞赏,



我广泛使用所有类型的标准容器(vector,set,

map等)。使用它们似乎没什么好处,只要

你试图保持在脑海中复制整个

容器可能会很昂贵,通过参考传递是优惠。


就这个小组而言,我认为普遍的共识是

使用STL。


2007年10月10日星期三15:10:53 -0500,Stephan Rose写道:


>我的一个项目确实很重使用各种数组我目前正在为此目的使用自定义类,在这里我只是在思考潜在的STL可能是一个更好的主意。



但是不是std :: vector只是一个瘦的包装而不是realloc吗?

-

Roland Pibinger

最好的软件简单,优雅,充满戏剧性 - Grady Booch


2007年10月10日星期三15:10:53 -0500,Stephan Rose写道:


我的一个项目确实大量使用了各种数组,我现在正在使用定制的类来实现这个目的而且这里只是

pondering如果潜在的STL可能是一个更好的主意。



Hello Stephan,


好​​吧,听起来好像在问我自己我应该再发明一下这个轮子吗? "对于

我。


我更喜欢使用STL,以防我必须使用复杂的数组类型。唯一的

例外是当我需要运行超过最优的东西或

minimalistic时。然后主要尝试实现我自己的数组。


例如我必须为项目使用一种键字符串索引数组,

但它必须通过同时搜索快速。所以我必须实现

我自己的数组类型。但对我来说这些情况非常罕见。


在大多数情况下,如果我必须使用已经发明的东西,那么

会为我做的工作,例如一个向量,然后我不会将我的

头撞到墙上来实现一个新的向量类。这将是

绝对浪费宝贵的时间和braincells。


正如你所看到的,这都是你写的给定任务的问题你的

计划。


希望这可以帮助你决定......这只是我使用

的方式STL与否。这并不意味着你也必须遵循这种方式。 * wink *


Greets,

Andreas E. Mueller


PS。对不起我的英语,我不是母语为英语的人,但是我还是想继续努力改善它。


Hey everyone,

I was just wondering what the general consensus is on STL these days.

I think that if I remember right, several years ago, most people (if not
everyone) I knew anyway stayed far away from it.

I then switched to C# for several years and didn''t worry about it much,
but having switched back to more C++ work earlier this year, I was just
wondering about that. =)

One of my projects does make heavy use of various arrays where I am
currently using custom made classes for that purpose and here I was just
pondering if potentially STL may be a better idea.

Any thoughts / suggestions would be appreciated,

Thanks,

--
Stephan
2003 Yamaha R6

???????????¨????????o?????¥??a?????|??a????????ˉ
???????????¨???????????¨????????a?????????

解决方案

"Stephan Rose" <no****@spammer.comwrote in message
news:p8******************************@giganews.com ...

Hey everyone,

I was just wondering what the general consensus is on STL these days.

I think that if I remember right, several years ago, most people (if not
everyone) I knew anyway stayed far away from it.

I then switched to C# for several years and didn''t worry about it much,
but having switched back to more C++ work earlier this year, I was just
wondering about that. =)

One of my projects does make heavy use of various arrays where I am
currently using custom made classes for that purpose and here I was just
pondering if potentially STL may be a better idea.

Any thoughts / suggestions would be appreciated,

I make extensive use of the standard containers of all types (vector, set,
map, etc...). There seems to be little penalty for using them as long as
you try to keep in your head that it can be expensive to copy an entire
container, passing by reference is prefered.

As far as this group goes, I would think the general consensus would be to
use the STL.


On Wed, 10 Oct 2007 15:10:53 -0500, Stephan Rose wrote:

>One of my projects does make heavy use of various arrays where I am
currently using custom made classes for that purpose and here I was just
pondering if potentially STL may be a better idea.

But isn''t std::vector just a thin wrapper over realloc?
--
Roland Pibinger
"The best software is simple, elegant, and full of drama" - Grady Booch


On Wed, 10 Oct 2007 15:10:53 -0500, Stephan Rose wrote:

One of my projects does make heavy use of various arrays where I am
currently using custom made classes for that purpose and here I was just
pondering if potentially STL may be a better idea.

Hello Stephan,

well, it sound''s like asking myself "should I invent the wheel again?" for
me.

I prefer using the STL in case I have to use complex array types. The only
exception is when I need something to run more than optimal or
minimalistic. Then mostly try to implement my own arrays.

For example I had to use a kind of key string indexed array for a project,
but it had to be fast by searching at the same time. So I had to implement
my own array type. But these are really rare situations for me.

In the most cases, if I have to use something already invented, which
would do the work for me, for example a vector, then I would not crash my
head against the wall to implement a new vector class. This would be
definitely a waste of precious time and braincells.

As you can see, it''s all a matter of the given tasks you write your
program for.

Hope this can help you to decide... This is only my way about using the
STL or not. It doesn''t mean that you have to follow this way too. *wink*

Greets,
Andreas E. Mueller

PS. Sorry about my English, I''m not a native English speaker, but I''m
still trying to get better on it.


这篇关于STL与否?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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