So i finishe my c++ course, my first programming language and am spying at python too ;)
i have to say that i was not taught much about the standard template library...only vectors. Ok, so i want to know how you guys managed to master that library..going thru it i realize there is a whole lot to learn...how come i was taught vectors and nothing was mentioned about the header algorithm?..because it seems when i use vectors i always have to use the header iterator and 90% of the time something from the header algorithm...how come some of you guys are soo good? did you learn it on your own, were you having better teachers? online tutorials or what?
tell me something guys..any good advice will be much appreciated
I'm completely self-taught in C++, and I can say that it's pretty easy to learn actually - whenever you want to know what this generation's 'best way' to do something is, just google it and most likely you will get several stack overflow results as well as some other web pages dedicated to what you googled.
If you want to start getting familiar with the standard library, try writing program without ever using real raw pointers - in modern C++, you should never truly need to use a real raw pointer, instead you should use the smart pointer classes (e.g. std::unique_ptr).
EDIT: As Catfish4 said below, 99% of the time someone has already done what you're trying to do and you are strongly encouraged to save time by using the existing code instead of rewriting your own with possible mistakes. Like I said, just google "C++ how to _____" or "C++11 how to _____" and you will generally get great results.
Ok, so i want to know how you guys managed to master that library..going thru it i realize there is a whole lot to learn...
All you need is to ask yourself "does C++ already have this?"
For example, maybe you need to sort an array. Should you write the sort() function yourself? Well ask yourself the previous question, does C++ already have a sort() function I can use? Yes. And it's in the algorithm library.
It's the same with all other parts of the library. You don't learn them, you use them. You search for what the C++ library offers, so that you have the least amount of work to do yourself.
how come i was taught vectors and nothing was mentioned about the header algorithm?
It's most likely because the teachers want you to do things the hard way, in order to learn.
How would you learn how to sort if you simply used std::sort()?
How would you learn how a linked list is coded if you simply used std::list?
How would you learn how to search for the maximum element in an array if you simply used std::max_element()?
@ Catfish4...i love the way you see things..I agree with you about the teaching part..and am gonna adopt your method of asking if c++ have a way of doing things before i try to implemente my own (which always never works anyway :P haha)
did you learn it on your own, were you having better teachers? online tutorials or what?
I've always seen the language and its standard library as one entity (after all, you can't write a hello world program without using the standard library). it's not all that big, compared to some third-party libraries like boost, ACE, or Qt, it's perfectly possible to learn what's available. It takes practice to learn how to use what's available, though.
As for the containers, iterators, algorithms, and a few other parts of the C++ standard library that are sometimes called 'STL' after the library that inspired them, the book 'Effective STL' by Scott Meyers is a good start.