1// (C) Copyright Beman Dawes 2009 2 3// Use, modification and distribution are subject to the 4// Boost Software License, Version 1.0. (See accompanying file 5// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 7// See http://www.boost.org/libs/config for more information. 8 9// MACRO: BOOST_NO_CXX11_HDR_EXCEPTION 10// TITLE: C++11 header <exception> not compatible 11// DESCRIPTION: The standard library does not provide a C++11 compatible version of <exception>. 12 13#include <exception> 14 15namespace boost_no_cxx11_hdr_exception { 16 17 int test() 18 { 19#ifdef BOOST_NO_EXCEPTIONS 20 using std::exception_ptr; 21 using std::current_exception; 22 using std::rethrow_exception; 23 return 0; 24#else 25 std::exception_ptr ep; 26 try 27 { 28 throw 42; 29 } 30 catch (...) 31 { 32 ep = std::current_exception(); 33 } 34 try 35 { 36 std::rethrow_exception(ep); 37 } 38 catch (int i) 39 { 40 // return zero on success 41 return i == 42 ? 0 : 1; 42 } 43 return 1; 44#endif 45 } 46 47} 48