Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

std::any and std::exception_ptr

131 views
Skip to first unread message

johannes.g...@googlemail.com

unread,
Dec 22, 2015, 7:50:19 AM12/22/15
to
{ 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
particular,

** std::exception_ptr should be able to be converted into a std::any,
as,
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
contents
(not the std::any itself). This would permit the preparation of
a potential exception in advance and throwing it at a later point in
time.

Best regards,
Johannes


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

0 new messages