forked from boostorg/utility
fix result_of ambiguity error for nullary functions
[SVN r36773]
This commit is contained in:
1 parent
63cde4d3fd
commit
66514f61ff
3 files changed
+35
-8
No files matched your search
@@ -24,25 +24,27 @@ struct result_of<F(BOOST_RESULT_OF_ARGS)>
|
||||
: detail::result_of_impl<F, F(BOOST_RESULT_OF_ARGS), (detail::has_result_type<F>::value)> {};
|
||||
#endif
|
||||
|
||||
#undef BOOST_RESULT_OF_ARGS
|
||||
|
||||
#if BOOST_PP_ITERATION() >= 1
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
||||
struct result_of_impl<R (*)(BOOST_RESULT_OF_ARGS), FArgs, false>
|
||||
struct result_of_impl<R (*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), FArgs, false>
|
||||
{
|
||||
typedef R type;
|
||||
};
|
||||
|
||||
template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
||||
struct result_of_impl<R (&)(BOOST_RESULT_OF_ARGS), FArgs, false>
|
||||
struct result_of_impl<R (&)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), FArgs, false>
|
||||
{
|
||||
typedef R type;
|
||||
};
|
||||
|
||||
#undef BOOST_RESULT_OF_ARGS
|
||||
|
||||
#if BOOST_PP_ITERATION() > 1 && !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
|
||||
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
|
||||
template<typename R, typename FArgs BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),typename T)>
|
||||
struct result_of_impl<R (T0::*)
|
||||
@@ -84,3 +86,4 @@ struct result_of_impl<R (T0::*)
|
||||
#endif
|
||||
|
||||
}
|
||||
#endif
|
||||
@@ -31,6 +31,24 @@ 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>
|
||||
{
|
||||
@@ -44,9 +62,8 @@ struct result_of_impl<F, FArgs, false>
|
||||
|
||||
template<typename F>
|
||||
struct result_of_impl<F, F(void), false>
|
||||
{
|
||||
typedef void type;
|
||||
};
|
||||
: result_of_void_impl<F>
|
||||
{};
|
||||
|
||||
} // end namespace detail
|
||||
|
||||
|
||||
Reference in new issue
Block a user