开发者

Learning the C++ Standard library - a good idea?

开发者 https://www.devze.com 2022-12-22 08:17 出处:网络
I am a beginner programmer in C++, and I still learning the bases, but I have a simple question about The Standar开发者_Go百科d library and STL in C++, I think this is not from The Core of the languag

I am a beginner programmer in C++, and I still learning the bases, but I have a simple question about The Standar开发者_Go百科d library and STL in C++, I think this is not from The Core of the language, I mean this library just make programming and portability easier, and that mean if I learned and mastered C++ rules, I can build my own, I mean in general this call experience by practicing. Example: cout is the standard output function, but if I want to program a GUI software for Windows for example, I will never just look at it!! My Question:Is that True?and if not, Why?


You can't really be said to be a C++ programmer without a good knowledge of the standard library. And writing your own is a very bad idea. I strongly recommend you get a copy of Nicolai Josuttis's book and embrace the power it will give you. You will learn, for example, that streams are not only good for performing I/O in console applications.

And maybe you should also take a look at Good Idea / Bad Idea Should I Reimplement Most Of C++?, which discusses the pros & cons of writing your own standard library.


You are correct that the C++ standard library are not part of the "core language" and that most of what the standard library offers you can be achieved independently using only the features core language.

However, it is much to your advantage to learn the standard library. Why waste time rewriting functions that are already there for you? If you chose to rewrite them anyway, your versions will likely be buggy. That's just one of the truths of software development, no matter how good you are, but more so if you're a beginner to the language. In contrast, the implementations out there are tried and tested in the field.


Looking for Your sample that std::cout is not useful withing GUI programming is not entirely true. Even if You will not use cout it is worth to know std::basic_ostream for simple string formatting abilities.


You won't use everything from the STL, but MAN are those string and container classes, and sometimes the algorithms, useful!

0

精彩评论

暂无评论...
验证码 换一张
取 消