Begin and End with range-based for loops
C++ 23 Feb 2019 985Start using `begin` and `end` without defining a global function templates or via preferences of `std::begin`, `std::end`. Simplest possible solutions are usually the best so it would be to easier to just declare the functions the same way that `std::begin()` and `std::end()` are already declared.
Trigger `SFINE` so only types which have a public member can be invoked with empty parameters, so any other use cases won't be affected, hence no other overloading in the system.
"On slack the other day, someone mentioned that lots of companies don't use range-based for loops in their code because they use PascalCase identifiers, and their containers thus have Begin and End mem..."
Author
Just Software Solutions
For further author's articles please visit the author's website.
https://www.justsoftwaresolutions.co.uk/