C++ - loop optimization with Sentinel

less than 1 minute read

It is possible to make the loop faster by using an guarded value so it doesn't need to check the variable validation or extran comparing.

https://en.wikipedia.org/wiki/Sentinel_node