What are some good (small) git* projects that can be used for learning purposes?
It is really difficult to find small projects that:
1. Use modern C++
2. Are small
3. Use good practices
Thank you :)
hehe... I would argue that reading bad code is the better skill to have... there is a lot more of it out there so odds are whatever you encounter won't be amazingly readable.
I don't have anything in mind that would help you, apart from advising you to read whatever small project you are interested in, and if the quality is lacking in places, that is real world code...
You can learn a lot right here on this forum. Read the answers from the frequent contributors. JLBorges in particular makes heavy use of the standard library and modern methods.
But finding the bug wasn't really the point I was trying to make. It was to critique code you see.
The other issue is passing the function params by value (involving a copy) and not by const ref. Passing v if an int by value is OK, but what if v is of type std::string?
Fair enough. Not sure if the constant reference applies more to the initialiser list than to the comparator value v.
It depends what types the template function is intended to work with. I wouldn't dream of passing a simple numerical value (int, double, etc. ) by constant reference as the overhead for a reference outweighs the pass by value. But for larger classes or arrays, then yes.
You've probably observed that I don't exactly go overboard on the use of qualifiers like "const". I prefer the "get the calculation done", not "make it unbreakable" code.