But I don't really know which ideal solution I should choose. They both do excellent jobs. That is why I have two different namespaces : JLBorges && closed_account_5a8Ym39o6. I have learnt quite a lot from the Closed account's solution and grasped the general idea of how the algorithm works. I am no expert and I am here to seek help so I have no right to say which one is worse than the other. But I am interested in your (genuine) thoughts about the two solutions, because you guys are all code experts which is why I love you guys so much.
So :
+ Which solution is more competitive?
+ Which solution looks cleaner and more friendly?
+ Which solution is easier to use?
+ Which solution is faster?
+ Which solution is more reliable?
+ Which solution is more versatile?
+ Which solution is better overall?
And thank you again for helping me. You guys are so great! :D :D
Okay, JLBorges is an absolute C++ master, just like what you say. How long must I have to work and study hard to be able to keep up with him? I am scared, the more I continue to learn like that, the more I become like a bookworm, and the more my life will get ruined. It is not like I do not want to become someone like him, he is my ideal man after all, but I doubt there will be always consequences here and there if I attempt to overdo myself...
Edit: Sorry if I made assumptions about you being a student - that could be wrong - I apologise if that is the case :+)
Realise that it takes a long time to become an expert - I am very far from that, I envisage a lifetime of learning C++ - there are so many new things all the time.
About those who are experts, they probably have the benefit of at least a Degree, possibly Masters or even PhD. Then they may have 1-4 decades of industry experience as developers. Some of them are Lecturers.
So all that one can do is keep plugging away at it, learn things gradually by writing code, testing things. Solely reading books or reference material, while necessary might not be the only way - it's too easy for things bounce off or not be absorbed by the Noodle :+)
Don't overdo yourself - you still need to have a life. There is family, friends, sport. You also probably don't want to learn C++ at the expense of your other study in that you don't to fail the year because of it. Maybe you could allocate a certain number of hours per week for learning C++? Don't sweat it about becoming an expert, just being a little better than your peers could be a suitable goal.
Also realise that when looking at some complex code, one can usually always break it down into smaller expressions. Examine what they mean in isolation, then think about what it means as a whole. Draw pictures with actual old school pen and paper :+) If you can't figure it out, ask questions here on the forum. If someone has posted code, they would be happy to explain it.
There are different areas or paradigms of C++. There is C code; then C++ with things like overloaded functions, classes etcetera, the STL; then templates; then Template Meta Programming (TMP) IMO this is the most complicated part. So when looking at some complex code, realise it might be part of a paradigm that you are not ready for yet. Then there are things like Design Patterns - another whole area of study.
As well as all that, there are other libraries like boost for example - there is heaps of learning there too. But I would imagine one wouldn't sit down and say I am going to learn boost from beginning to end. Probably better to learn individual things as they might be needed.
Then there are frameworks like Qt - yet another lifetime of things to learn there. Then even more things like using C++ to deal with Databases - PostgreSQL for example.
So in summary, don't sweat it about being in a hurry to try to learn everything in the C++ Galaxy, one can only do so much.
It's like if you wanted to become a Doctor or Dentist - there's lots of study to do, it doesn't happen in a short time. You don't have to try to be the University's top Professor by the end of the year. Also one doesn't have to be a specialist in every field - one could be a GP or a specialist in one field.
As I said you are winning if you are a little bit better than your peers.