On Sunday, 12 August 2018 at 00:15:37 UTC, Cecil Ward wrote:
Paul, what would the calls look like?

I am about to misunderstand things completely so here goes :-)

It would be a bit kludgy having to switch from one calling syntax to another, putting the mask argument in the template parameters or in the normal position. Or have I misunderstood? And if the caller did not use the right call syntax variant then the optimisation would not happen. Thing is, as it is the details are nicely hidden and the caller does not even need to thing about the fact that an (eponymous) template is being used.

As far as I know, there's no way to *guarantee* the optimization and keep the normal function call syntax. Probably the best you can do is write the mask check as a regular if statement, put `pragma(inline, true)` in the function, and hope the optimizer is smart enough to get rid of the branch.

Reply via email to