• std::any and std::exception_ptr

    From johannes.gerd.becker@googlemail.com@21:1/5 to All on Tue Dec 22 06:40:44 2015
    { edited by mod to shorten lines to ~70 characters. -mod }

    [mistakenly posted to comp.lang.c++ before]

    N3804 proposes the introduction of std::any.

    Now, C++ already has an "any"-like type, namely std::exception_ptr. Semantically, after the introduction of std::any, exception_ptr will be
    a special case of std::any, namely a semantical std::any initialized by
    a caught exception.

    Wouldn't it make sense to make these two interoperate nicely? In

    ** std::exception_ptr should be able to be converted into a std::any,
    currently, the only way of looking into an exception_ptr is re-throwing
    and catching immediately (please correct me if I am wrong).

    ** std::rethrow_exception should accept a std::any, throwing its
    (not the std::any itself). This would permit the preparation of
    a potential exception in advance and throwing it at a later point in

    Best regards,

    [ See http://www.gotw.ca/resources/clcm.htm for info about ]
    [ comp.lang.c++.moderated. First time posters: Do this! ]

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)