简体   繁体   English

是跨平台和性能的c ++ STL算法和容器?

[英]is c++ STL algorithms and containers same across platforms and performance?

After learning good amount of c++, i'm now into STL containers and algorithms template library, my major concerns are, 在学习了大量的c ++之后,我现在进入了STL容器和算法模板库,我的主要关注点是,

1) Is this library same across different platforms like MS, linux n other os? 1)这个库是否在MS,linux和其他操作系统等不同平台上相同?

2) will quality or efficiency of program c++ module decrease with more use of STL containers and algorithms, i think i can't customize it to all needs. 2)程序c ++模块的质量或效率会随着STL容器和算法的使用而减少,我想我无法根据所有需求对其进行定制。

3) Is this template library good to use in linux system programming, kernel modules? 3)这个模板库是否适合在linux系统编程,内核模块中使用?

4) lastly can i use this in programming contests, because it relives a lot of coding and pressure off shoulders. 4)最后我可以在编程竞赛中使用它,因为它重复了大量的编码和压力。

1) Is this library same across different platforms like MS, linux n other os? 1)这个库是否在MS,linux和其他操作系统等不同平台上相同?

No. Except the standardized interface, the implementations are all different for each compiler suite , and sometimes they also provide custom extensions such as hash_map . 不是。除了标准化接口之外,每个编译器套件的实现都是不同的,有时它们还提供自定义扩展,例如hash_map

2) will quality or efficiency of program c++ module decrease with more use of STL containers and algorithms, i think i can't customize it to all needs. 2)程序c ++模块的质量或效率会随着STL容器和算法的使用而减少,我想我无法根据所有需求对其进行定制。

I don't think so. 我不这么认为。 The quality and efficiency should be much better than cooking one up by your own, unless you have very special needs. 除非你有非常特殊的需求,否则质量和效率应该比你自己做的更好。

3) Is this template library good to use in linux system programming, kernel modules? 3)这个模板库是否适合在linux系统编程,内核模块中使用?

Better use C for the kernel. 更好地使用C作为内核。

4) lastly can i use this in programming contests, because it relives a lot of coding and pressure off shoulders. 4)最后我可以在编程竞赛中使用它,因为它重复了大量的编码和压力。

Depends on the rules of the contests. 取决于比赛的规则。

1) Standard (interface) is the same. 1)标准(接口)是相同的。 Implementation is different. 实施方式不同。

2) Quality or efficiency of your program depends only on your skills. 2)您的课程的质量或效率仅取决于您的技能。 STL provides you benefits you can use and misuse. STL为您提供可以使用和滥用的好处。

3) Not for kernel modules, yes for user mode applications. 3)不适用于内核模块,适用于用户模式应用程序。

4) Normally C++ contests allow STL. 4)通常C ++竞赛允许STL。

1) API same. 1)API相同。 Limiting behavior specified in the standard (eg O(n) ). 限制标准中规定的行为(例如O(n))。 Implementation vendor specific. 实施供应商特定。 Means you can rely on the scaling of your app. 意味着您可以依赖应用程序的扩展。

2) As long as you have to ask this questions, the quality and efficiency of your code is likey to improve by using the STL. 2)只要您必须提出这些问题,您的代码的质量和效率就可以通过使用STL来改善。

3) Not in the kernel. 3)不在内核中。

4) C++ constests should allow STL. 4)C ++的测试应该允许STL。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM