forked from boostorg/utility
https://svn.boost.org/svn/boost/trunk ........ r42194 | anthonyw | 2007-12-19 23:46:00 -0800 (Wed, 19 Dec 2007) | 1 line added missing parentheses ........ r42195 | anthonyw | 2007-12-20 00:37:02 -0800 (Thu, 20 Dec 2007) | 1 line added hardware_concurrency support for apple, freebsd and sun platforms ........ r42196 | niels_dekker | 2007-12-20 01:09:44 -0800 (Thu, 20 Dec 2007) | 1 line Removed "mark-expected-failures" from value_init_test, for both Borland and GCC, as value_init.hpp changeset [41942] provides a workaround for them. ........ r42202 | fmhess | 2007-12-20 06:39:53 -0800 (Thu, 20 Dec 2007) | 6 lines Made putting the name of a typedef inside a "classname" element successfully produce a link to the typedef's reference documentation, or to the typedef's synopsis if that is all it has. ........ r42217 | vladimir_prus | 2007-12-20 13:18:47 -0800 (Thu, 20 Dec 2007) | 1 line Explain a couple of gcc limitations with precompiled headers ........ r42220 | matias | 2007-12-20 13:56:39 -0800 (Thu, 20 Dec 2007) | 1 line add explicit std::string initialization ........ r42221 | matias | 2007-12-20 13:59:18 -0800 (Thu, 20 Dec 2007) | 1 line add license to each html page ........ r42222 | matias | 2007-12-20 14:15:11 -0800 (Thu, 20 Dec 2007) | 1 line Time out: test_bimap_property_map @ gcc-3.4.6_linux_x86_64 ........ r42223 | djowel | 2007-12-20 15:24:28 -0800 (Thu, 20 Dec 2007) | 1 line Removing fusion variant adapter ........ r42224 | djowel | 2007-12-20 15:28:26 -0800 (Thu, 20 Dec 2007) | 1 line Removing fusion variant adapter ........ r42227 | nmusatti | 2007-12-20 23:03:44 -0800 (Thu, 20 Dec 2007) | 1 line Increased the latest supported version to 5.9.3, corresponding to the December 2007 update. ........ r42228 | anthonyw | 2007-12-21 02:54:59 -0800 (Fri, 21 Dec 2007) | 1 line Updated thread ID test ........ r42229 | anthonyw | 2007-12-21 03:05:37 -0800 (Fri, 21 Dec 2007) | 1 line Markup hardware_concurrency failure as expected on tru64 platforms, as support is not implemented ........ r42234 | dgregor | 2007-12-21 13:18:17 -0800 (Fri, 21 Dec 2007) | 1 line Reduce header dependencies, from Shunsuke Sogame. Fixes #1535 ........ [SVN r42236]
90 lines
2.2 KiB
C++
90 lines
2.2 KiB
C++
// Boost result_of library
|
|
|
|
// Copyright Douglas Gregor 2004. Use, modification and
|
|
// distribution is subject to the Boost Software License, Version
|
|
// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
|
// http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
// For more information, see http://www.boost.org/libs/utility
|
|
#ifndef BOOST_RESULT_OF_HPP
|
|
#define BOOST_RESULT_OF_HPP
|
|
|
|
#include <boost/config.hpp>
|
|
#include <boost/preprocessor/iteration/iterate.hpp>
|
|
#include <boost/preprocessor/punctuation/comma_if.hpp>
|
|
#include <boost/preprocessor/repetition/enum_params.hpp>
|
|
#include <boost/preprocessor/repetition/enum_shifted_params.hpp>
|
|
#include <boost/detail/workaround.hpp>
|
|
#include <boost/mpl/has_xxx.hpp>
|
|
#include <boost/mpl/if.hpp>
|
|
#include <boost/mpl/bool.hpp>
|
|
|
|
#ifndef BOOST_RESULT_OF_NUM_ARGS
|
|
# define BOOST_RESULT_OF_NUM_ARGS 10
|
|
#endif
|
|
|
|
namespace boost {
|
|
|
|
template<typename F> struct result_of;
|
|
|
|
#if !defined(BOOST_NO_SFINAE) && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
|
namespace detail {
|
|
|
|
BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type)
|
|
|
|
template<typename F, typename FArgs, bool HasResultType> struct result_of_impl;
|
|
|
|
template<typename F>
|
|
struct result_of_void_impl
|
|
{
|
|
typedef void type;
|
|
};
|
|
|
|
template<typename R>
|
|
struct result_of_void_impl<R (*)(void)>
|
|
{
|
|
typedef R type;
|
|
};
|
|
|
|
template<typename R>
|
|
struct result_of_void_impl<R (&)(void)>
|
|
{
|
|
typedef R type;
|
|
};
|
|
|
|
template<typename F, typename FArgs>
|
|
struct result_of_impl<F, FArgs, true>
|
|
{
|
|
typedef typename F::result_type type;
|
|
};
|
|
|
|
template<typename FArgs>
|
|
struct is_function_with_no_args : mpl::false_ {};
|
|
|
|
template<typename F>
|
|
struct is_function_with_no_args<F(void)> : mpl::true_ {};
|
|
|
|
template<typename F, typename FArgs>
|
|
struct result_of_nested_result : F::template result<FArgs>
|
|
{};
|
|
|
|
template<typename F, typename FArgs>
|
|
struct result_of_impl<F, FArgs, false>
|
|
: mpl::if_<is_function_with_no_args<FArgs>,
|
|
result_of_void_impl<F>,
|
|
result_of_nested_result<F, FArgs> >::type
|
|
{};
|
|
|
|
} // end namespace detail
|
|
|
|
#define BOOST_PP_ITERATION_PARAMS_1 (3,(0,BOOST_RESULT_OF_NUM_ARGS,<boost/utility/detail/result_of_iterate.hpp>))
|
|
#include BOOST_PP_ITERATE()
|
|
|
|
#else
|
|
# define BOOST_NO_RESULT_OF 1
|
|
#endif
|
|
|
|
}
|
|
|
|
#endif // BOOST_RESULT_OF_HPP
|