1 // Boost.Signals2 library
3 // Copyright Douglas Gregor 2001-2004.
4 // Copyright Frank Mori Hess 2007. Use, modification and
5 // distribution is subject to the Boost Software License, Version
6 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 // For more information, see http://www.boost.org
11 #ifndef BOOST_SIGNALS2_RESULT_TYPE_WRAPPER_HPP
12 #define BOOST_SIGNALS2_RESULT_TYPE_WRAPPER_HPP
14 #include <boost/config.hpp>
19 // A placeholder for void on compilers that don't support void returns
22 // Replaces void with void_type
28 struct nonvoid<void> {
29 typedef void_type type;
32 // Replaces void with void_type only if compiler doesn't support void returns
34 struct result_type_wrapper {
37 #ifdef BOOST_NO_VOID_RETURNS
39 struct result_type_wrapper<void> {
40 typedef void_type type;
44 // specialization deals with possible void return from combiners
45 template<typename R> class combiner_invoker
48 typedef R result_type;
49 template<typename Combiner, typename InputIterator>
50 result_type operator()(Combiner &combiner,
51 InputIterator first, InputIterator last) const
53 return combiner(first, last);
56 template<> class combiner_invoker<void>
59 typedef result_type_wrapper<void>::type result_type;
60 template<typename Combiner, typename InputIterator>
61 result_type operator()(Combiner &combiner,
62 InputIterator first, InputIterator last) const
64 combiner(first, last);
68 } // end namespace detail
69 } // end namespace signals2
70 } // end namespace boost
72 #endif // BOOST_SIGNALS2_RESULT_TYPE_WRAPPER_HPP