19 May
2017
19 May
'17
2:39 p.m.
Niall Douglas wrote:
https://github.com/ned14/boost.outcome/blob/master/include/boost/outcome/v1....
The hack is the above. We cache the address of the canonical singleton, ...
Hm. I must be missing something. BOOSTLITE_NOINLINE inline const std::error_category &_generic_category() { const std::error_category &c = stl11::generic_category(); return c; } This doesn't cache anything. It just calls stl11::generic_category() and returns the result.
The resulting assembler generated is greatly improved on MSVC, a single result<T> shrinks from ~260 opcodes to less than 5.
Would be nice if we could see that demonstrated on godbolt.org.