简体   繁体   中英

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

I am a beginner programmer in C++, and I still learning the bases, but I have a simple question about The Standard 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.

您不会使用STL中的所有内容,但MAN是那些字符串和容器类,有时候算法很有用!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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