f



std::any and std::exception_ptr

{ 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
johannes
12/22/2015 6:40:44 AM
comp.lang.c++.moderated 10738 articles. 1 followers. allnor (8509) is leader. Post Follow

0 Replies
964 Views

Similar Articles

[PageSpeed] 51

Reply: