On Tuesday, March 29th, 2022 at 6:39 PM, Edward Catmur <ecatmur@googlemail.com> wrote:
Oh, nice. Still, relying on the optimizer virtualizing and inlining isn't always the best idea, and some optimizations (like constant folding, IIRC) don't make it across the function call boundary.
There is no "function call boundary"
involved here. The reason that this
code is inlined is as same as why
a function template specialization is
inlined. function_ref is built in a way
such that, if the compiler can see
both the callee to be erased and
the caller, there is no extra
abstraction cost. If you observed
an inferior codegen, the case may
worth looking into for the vendor.
--
Zhihao Yuan, ID lichray
The best way to predict the future is to invent it.
_______________________________________________