1 // Boost.TypeErasure library
3 // Copyright 2012 Steven Watanabe
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)
11 #if !defined(BOOST_PP_IS_ITERATING)
13 #ifndef BOOST_TYPE_ERASURE_DETAIL_NULL_HPP_INCLUDED
14 #define BOOST_TYPE_ERASURE_DETAIL_NULL_HPP_INCLUDED
16 #include <boost/config.hpp>
17 #include <boost/throw_exception.hpp>
18 #include <boost/type_traits/remove_pointer.hpp>
19 #include <boost/preprocessor/iteration/iterate.hpp>
20 #include <boost/preprocessor/repetition/enum_params.hpp>
21 #include <boost/preprocessor/repetition/enum_trailing_params.hpp>
22 #include <boost/type_erasure/config.hpp>
23 #include <boost/type_erasure/exception.hpp>
26 namespace type_erasure {
32 template<class Concept>
33 struct get_null_vtable_entry {
34 typedef ::boost::type_erasure::detail::null_throw<
35 typename ::boost::remove_pointer<typename Concept::type>::type> type;
38 #ifdef BOOST_NO_CXX11_VARIADIC_TEMPLATES
40 #define BOOST_PP_FILENAME_1 <boost/type_erasure/detail/null.hpp>
41 #define BOOST_PP_ITERATION_LIMITS (0, BOOST_TYPE_ERASURE_MAX_ARITY)
42 #include BOOST_PP_ITERATE()
46 template<class R, class... T>
47 struct null_throw<R(T...)> {
48 static R value(T...) {
49 BOOST_THROW_EXCEPTION(::boost::type_erasure::bad_function_call());
63 #define N BOOST_PP_ITERATION()
65 template<class R BOOST_PP_ENUM_TRAILING_PARAMS(N, class T)>
66 struct null_throw<R(BOOST_PP_ENUM_PARAMS(N, T))> {
67 static R value(BOOST_PP_ENUM_PARAMS(N, T)) {
68 BOOST_THROW_EXCEPTION(::boost::type_erasure::bad_function_call());