Keep the std::exception* or std::type_info* in folly::exception_wrapper
authorYedidya Feldblum <yfeldblum@fb.com>
Wed, 4 Jan 2017 21:24:48 +0000 (13:24 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Wed, 4 Jan 2017 21:33:09 +0000 (13:33 -0800)
commiteaa278a52d9d5878021637a850627b853009c8bd
tree7eafba3d3d329d467e3643900c62992221a2bfc2
parentdc938550557e34825c30056f916fd8eb81787076
Keep the std::exception* or std::type_info* in folly::exception_wrapper

Summary:
[Folly] Keep the `std::exception*` or `std::type_info*` in `folly::exception_wrapper`.

In the case of construction with a `std::exception_ptr`. Instead of keeping a pair of `std::string`s, strictly losing information (not that we use any more information, but theoretically we could).

Of note:
* Shrinks the size of `folly::exception_wrapper`, in all cases, to 48 bytes. Down from 32 bytes + 2 S bytes on 64-bit architectures, where S is the size in bytes of `std::string`. In particular, `libstdc++`'s implementation is 32 bytes, while `libc++`'s and Folly's implementations are 24 bytes on 64-bit architectures, for total original sizes of 96 bytes or 80 bytes.
* Allows to avoid rethrowing in `with_exception` in the case of an instance constructed with an `std::exception_ptr` plus an `std::exception&`.

Reviewed By: ericniebler

Differential Revision: D4369935

fbshipit-source-id: 35155e0b271959a4878fe077fc911b17767a2358
folly/ExceptionWrapper.cpp
folly/ExceptionWrapper.h