On 28/04/14 15:02 -0400, Tim Shen wrote:
If we want to change it to a runtime flag, it should be a class member. Otherwise we have to pass it as a function parameter all the time, and it may waste an instruction and one byte per recursive call. It surely make the code cleaner.
Data members are accessed through the 'this' pointer, which can require an indirection and be harder to optimise than a function parameter.
Am I premature optimizing?
I don't know yet - we need to measure. My concern is that making it a template parameter causes twice as much code to be instantiated, which makes executables bigger and can cause more I-cache misses.