]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // Boost.TypeErasure library |
2 | // | |
3 | // Copyright 2012 Steven Watanabe | |
4 | // | |
5 | // Distributed under the Boost Software License Version 1.0. (See | |
6 | // accompanying file LICENSE_1_0.txt or copy at | |
7 | // http://www.boost.org/LICENSE_1_0.txt) | |
8 | // | |
9 | // $Id$ | |
10 | ||
11 | #if !defined(BOOST_PP_IS_ITERATING) | |
12 | ||
13 | #ifndef BOOST_TYPE_ERASURE_DETAIL_NULL_HPP_INCLUDED | |
14 | #define BOOST_TYPE_ERASURE_DETAIL_NULL_HPP_INCLUDED | |
15 | ||
16 | #include <boost/throw_exception.hpp> | |
17 | #include <boost/type_traits/remove_pointer.hpp> | |
18 | #include <boost/preprocessor/iteration/iterate.hpp> | |
19 | #include <boost/preprocessor/repetition/enum_params.hpp> | |
20 | #include <boost/preprocessor/repetition/enum_trailing_params.hpp> | |
21 | #include <boost/type_erasure/config.hpp> | |
22 | #include <boost/type_erasure/exception.hpp> | |
23 | ||
24 | namespace boost { | |
25 | namespace type_erasure { | |
26 | namespace detail { | |
27 | ||
28 | template<class Sig> | |
29 | struct null_throw; | |
30 | ||
31 | template<class Concept> | |
32 | struct get_null_vtable_entry { | |
33 | typedef ::boost::type_erasure::detail::null_throw< | |
34 | typename ::boost::remove_pointer<typename Concept::type>::type> type; | |
35 | }; | |
36 | ||
37 | #define BOOST_PP_FILENAME_1 <boost/type_erasure/detail/null.hpp> | |
38 | #define BOOST_PP_ITERATION_LIMITS (0, BOOST_TYPE_ERASURE_MAX_ARITY) | |
39 | #include BOOST_PP_ITERATE() | |
40 | ||
41 | } | |
42 | } | |
43 | } | |
44 | ||
45 | #endif | |
46 | ||
47 | #else | |
48 | ||
49 | #define N BOOST_PP_ITERATION() | |
50 | ||
51 | template<class R BOOST_PP_ENUM_TRAILING_PARAMS(N, class T)> | |
52 | struct null_throw<R(BOOST_PP_ENUM_PARAMS(N, T))> { | |
53 | static R value(BOOST_PP_ENUM_PARAMS(N, T)) { | |
54 | BOOST_THROW_EXCEPTION(::boost::type_erasure::bad_function_call()); | |
55 | } | |
56 | }; | |
57 | ||
58 | #undef N | |
59 | ||
60 | #endif |