mirror of
https://github.com/boostorg/utility.git
synced 2025-05-09 15:04:00 +00:00
Fix result_of's handling of F(void).
[SVN r37140]
This commit is contained in:
parent
66514f61ff
commit
2d860e2574
@ -15,6 +15,8 @@
|
|||||||
#include <boost/preprocessor.hpp>
|
#include <boost/preprocessor.hpp>
|
||||||
#include <boost/detail/workaround.hpp>
|
#include <boost/detail/workaround.hpp>
|
||||||
#include <boost/mpl/has_xxx.hpp>
|
#include <boost/mpl/has_xxx.hpp>
|
||||||
|
#include <boost/mpl/if.hpp>
|
||||||
|
#include <boost/mpl/bool.hpp>
|
||||||
|
|
||||||
#ifndef BOOST_RESULT_OF_NUM_ARGS
|
#ifndef BOOST_RESULT_OF_NUM_ARGS
|
||||||
# define BOOST_RESULT_OF_NUM_ARGS 10
|
# define BOOST_RESULT_OF_NUM_ARGS 10
|
||||||
@ -55,14 +57,21 @@ struct result_of_impl<F, FArgs, true>
|
|||||||
typedef typename F::result_type type;
|
typedef typename F::result_type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename F, typename FArgs>
|
template<typename FArgs>
|
||||||
struct result_of_impl<F, FArgs, false>
|
struct is_function_with_no_args : mpl::false_ {};
|
||||||
: F::template result<FArgs>
|
|
||||||
{};
|
|
||||||
|
|
||||||
template<typename F>
|
template<typename F>
|
||||||
struct result_of_impl<F, F(void), false>
|
struct is_function_with_no_args<F(void)> : mpl::true_ {};
|
||||||
: result_of_void_impl<F>
|
|
||||||
|
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
|
} // end namespace detail
|
||||||
|
@ -79,6 +79,7 @@ int main()
|
|||||||
BOOST_STATIC_ASSERT((is_same<result_of<mem_func_ptr_v(X,char)>::type, int>::value));
|
BOOST_STATIC_ASSERT((is_same<result_of<mem_func_ptr_v(X,char)>::type, int>::value));
|
||||||
BOOST_STATIC_ASSERT((is_same<result_of<mem_func_ptr_cv(X,char)>::type, int>::value));
|
BOOST_STATIC_ASSERT((is_same<result_of<mem_func_ptr_cv(X,char)>::type, int>::value));
|
||||||
BOOST_STATIC_ASSERT((is_same<result_of<mem_func_ptr_0(X)>::type, int>::value));
|
BOOST_STATIC_ASSERT((is_same<result_of<mem_func_ptr_0(X)>::type, int>::value));
|
||||||
|
BOOST_STATIC_ASSERT((is_same<result_of<func_ptr(void)>::type, int>::value));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user