Chris@16
|
1
|
Chris@16
|
2 // Copyright Oliver Kowalke 2009.
|
Chris@16
|
3 // Distributed under the Boost Software License, Version 1.0.
|
Chris@16
|
4 // (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
5 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
6
|
Chris@16
|
7 #ifndef BOOST_COROUTINES_OLD_DETAIL_COROUTINE_GET_H
|
Chris@16
|
8 #define BOOST_COROUTINES_OLD_DETAIL_COROUTINE_GET_H
|
Chris@16
|
9
|
Chris@16
|
10 #include <boost/assert.hpp>
|
Chris@16
|
11 #include <boost/config.hpp>
|
Chris@16
|
12 #include <boost/type_traits/function_traits.hpp>
|
Chris@16
|
13
|
Chris@16
|
14 #include <boost/coroutine/detail/config.hpp>
|
Chris@16
|
15 #include <boost/coroutine/detail/param.hpp>
|
Chris@16
|
16
|
Chris@16
|
17 #ifdef BOOST_HAS_ABI_HEADERS
|
Chris@16
|
18 # include BOOST_ABI_PREFIX
|
Chris@16
|
19 #endif
|
Chris@16
|
20
|
Chris@16
|
21 namespace boost {
|
Chris@16
|
22 namespace coroutines {
|
Chris@16
|
23 namespace detail {
|
Chris@16
|
24
|
Chris@16
|
25 template<
|
Chris@16
|
26 typename D,
|
Chris@16
|
27 typename Result, int arity
|
Chris@16
|
28 >
|
Chris@16
|
29 struct coroutine_get;
|
Chris@16
|
30
|
Chris@16
|
31 template< typename D, int arity >
|
Chris@16
|
32 struct coroutine_get< D, void, arity >
|
Chris@16
|
33 {};
|
Chris@16
|
34
|
Chris@16
|
35 template< typename D, typename Result, int arity >
|
Chris@16
|
36 struct coroutine_get
|
Chris@16
|
37 {
|
Chris@16
|
38 bool has_result() const
|
Chris@16
|
39 { return static_cast< D const* >( this)->impl_->result_; }
|
Chris@16
|
40
|
Chris@16
|
41 typename param< Result >::type get() const
|
Chris@16
|
42 {
|
Chris@16
|
43 BOOST_ASSERT( static_cast< D const* >( this)->impl_->result_);
|
Chris@16
|
44 return static_cast< D const* >( this)->impl_->result_.get();
|
Chris@16
|
45 }
|
Chris@16
|
46 };
|
Chris@16
|
47
|
Chris@16
|
48 }}}
|
Chris@16
|
49
|
Chris@16
|
50 #ifdef BOOST_HAS_ABI_HEADERS
|
Chris@16
|
51 # include BOOST_ABI_SUFFIX
|
Chris@16
|
52 #endif
|
Chris@16
|
53
|
Chris@16
|
54 #endif // BOOST_COROUTINES_OLD_DETAIL_COROUTINE_GET_H
|