A future that does not carry any data (future<>) and its sibling (promise<>) are heavily used in the code. We can optimize them by overlaying the future's payload, which in this case can only be an std::exception_ptr, with the future state, as a pointer and an enum have disjoint values. This of course depends on std::exception_ptr being implemented as a pointer, but as it happens, it is. With this, sizeof(future<>) is reduced from 24 bytes to 16 bytes.
20 KiB
20 KiB