]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // Distributed under the Boost Software License, Version 1.0. (See |
2 | // accompanying file LICENSE_1_0.txt or copy at | |
3 | // http://www.boost.org/LICENSE_1_0.txt) | |
4 | // (C) Copyright 2014 Vicente J. Botet Escriba | |
5 | ||
6 | #ifndef BOOST_THREAD_EXCEPTIONAL_PTR_HPP | |
7 | #define BOOST_THREAD_EXCEPTIONAL_PTR_HPP | |
8 | ||
9 | #include <boost/thread/detail/move.hpp> | |
10 | #include <boost/exception_ptr.hpp> | |
11 | ||
12 | #include <boost/config/abi_prefix.hpp> | |
13 | ||
14 | namespace boost | |
15 | { | |
16 | struct exceptional_ptr { | |
17 | exception_ptr ptr_; | |
18 | ||
19 | exceptional_ptr() : ptr_() {} | |
20 | explicit exceptional_ptr(exception_ptr ex) : ptr_(ex) {} | |
21 | template <class E> | |
22 | explicit exceptional_ptr(BOOST_FWD_REF(E) ex) : ptr_(boost::copy_exception(boost::forward<E>(ex))) {} | |
23 | }; | |
24 | ||
25 | template <class E> | |
26 | inline exceptional_ptr make_exceptional(BOOST_FWD_REF(E) ex) { | |
27 | return exceptional_ptr(boost::forward<E>(ex)); | |
28 | } | |
29 | ||
30 | inline exceptional_ptr make_exceptional(exception_ptr ex) | |
31 | { | |
32 | return exceptional_ptr(ex); | |
33 | } | |
34 | ||
35 | inline exceptional_ptr make_exceptional() | |
36 | { | |
37 | return exceptional_ptr(); | |
38 | } | |
39 | ||
40 | } // namespace boost | |
41 | ||
42 | #include <boost/config/abi_suffix.hpp> | |
43 | ||
44 | #endif |