3 ms·
On my phone so cannot check, but I thought this was mostly a solved problem? Inlining/folding a jump table should be easy enough especially since the table can
by sesuximo 6y ago
On my phone so cannot check, but I thought this was mostly a solved problem? Inlining/folding a jump table should be easy enough especially since the table can be const
- steerablesafe 6y agohttps://godbolt.org/z/d4838K https://godbolt.org/z/d4838K Doesn't happen, apparently. edit: For a short while libc++ adopted mpark's variant visit, which AFAIK compiles down to switch case with some hand coding. AFAIK it had other problems so they rolled back to the constexpr array of function pointers. https://github.com/mpark/variant https://github.com/mpark/variant
- sesuximo 6y agoIf you call foo with an int or with a double, then it gets inlined. I don’t think they can inline foo as you’ve written it because the variant could be valueless by exception.