Re: [Boost-bugs] [Boost C++ Libraries] #12105: Support std::exception_ptr in boost::promise set_exception ??

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #12105: Support std::exception_ptr in boost::promise set_exception ??
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2018-01-23 16:30:07


#12105: Support std::exception_ptr in boost::promise set_exception ??
-------------------------------+------------------------------
  Reporter: RelicOfTesla@… | Owner: Anthony Williams
      Type: Feature Requests | Status: closed
 Milestone: | Component: thread
   Version: Boost 1.60.0 | Severity: Problem
Resolution: wontfix | Keywords:
-------------------------------+------------------------------

Comment (by joseph@…):

 Is there some reason you can't add a #define to use std::exception_ptr
 instead of boost::exception_ptr? The 2 are totally incompatible so any
 system libraries using std::exception_ptr (such as ISO/IEC TS 22277:2017
 coroutines) become a real burden to use with boost future (which has many
 wonderful features std::future does not). There does not appear to be a
 way to reliably convert between std::exception_ptr and
 boost::exception_ptr and the limited method I have found requires throwing
 2 additional times which is really wasteful.

 {{{
 namespace boost
 {
   template <>
   inline
     exception_ptr copy_exception(std::exception_ptr const &ex)
   {
     try {
       std::rethrow_exception(ex);
     }
     catch (const std::exception& e) {
       try {
         throw boost::enable_current_exception(e);
       }
       catch (...) {
         return boost::current_exception();
       }
     }
     catch (...) {
       try {
         throw boost::enable_current_exception(std::runtime_error("unknown
 exception"));
       }
       catch (...) {
         return boost::current_exception();
       }
     }
   }
 }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac10/boost/ticket/12105#comment:3>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2018-01-23 16:36:05 UTC