我不明白如何在C ++中使用STL [英] I don't understand how to use the STL in C++

查看:84
本文介绍了我不明白如何在C ++中使用STL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我发现STL太复杂了,无法理解其工作原理的逻辑.

我想找到一个涵盖字符串,数组,队列,双端队列,列表,链接列表,树,huffman,前缀后缀,堆栈的库,但我不喜欢许多库中使用的迭代器概念. div class ="h2_lin">解决方案

STL是STANDARD库.它是C ++的一部分.我所知道的唯一的其他库是Microsoft在获取STL实现时作为权宜之计编写的库.这是一个短期修复,很糟糕.迭代器的概念只是您需要了解的内容.根本不是很复杂.

STL是C ++的一部分.没有人会费心地为不需要修复的库提供替代方法,这是该语言的一部分.最接近的是boost,它可以扩展STL,但不能替代它.

您的另一种选择是学习C#,它不那么强大,但也不那么复杂.


在我看来,您似乎是在说您不了解标准库.它非常合逻辑,设计得很好,如果您想编写高效的C ++代码,则需要了解一些内容.我建议您购买一本很好的STL书籍并逐步学习,一路上,您将学到一些基本的计算机科学概念,即使您选择编写自己的容器而不充分利用STL的强大功能,它们也将为您提供极大的帮助. STL.


好.我接受你的理想.但是我想要更多您认为不错的库.


Hey everybody

I find the STL too complicated and cannot understand the logic of how it works.

I want to find a different library that covers things like string, array, queue, deque, list, link list, tree, huffman, prefix-suffix, stack, but I don''t like the iterator concept used in many libraries.

解决方案

STL is the STANDARD library. It''s part of C++. The only other library I know of, is the one Microsoft wrote as a stopgap while they worked on getting an STL implimentation. It was a short term fix, and it sucked. The concept of iterators is simply something you will need to understand. It''s not very complicated at all.

The STL is part of C++. No-one is going to bother providing an alternative to a library that doesn''t need fixing, and that is part of the language. The closest you can get, is boost, which EXTENDS STL, it does not replace it.

Your other alternative is to learn C# instead, which is not as powerful, but also not as complicated.


You seem to me to be saying that you don''t understand the standard library. It is VERY logical, VERY well designed and something you will need to understand if you want to write efficient C++ code. I''d suggest you buy a good STL book and work through it, along the way you''ll learn some basic computer science concepts that will help you enormously, even if you choose to write your own containers and not harness the power of STL.


Ok. i accept your ideal. But i want more the libraries you think they are good.


这篇关于我不明白如何在C ++中使用STL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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