forked from boostorg/utility
result_of: merge [80445], [80452], [80535], [80550], [80605], [80608] from trunk
[SVN r80621]
This commit is contained in:
@@ -129,6 +129,27 @@ struct no_result_type_or_result_template
|
||||
#endif
|
||||
};
|
||||
|
||||
// sfinae_tests are derived from example code from Joel de Guzman,
|
||||
// which demonstrated the interaction between result_of and SFINAE.
|
||||
template <typename F, typename Arg>
|
||||
typename boost::result_of<F(Arg const&)>::type
|
||||
sfinae_test(F f, Arg const& arg)
|
||||
{
|
||||
return f(arg);
|
||||
}
|
||||
|
||||
template <typename F, typename Arg>
|
||||
typename boost::result_of<F(Arg&)>::type
|
||||
sfinae_test(F f, Arg& arg)
|
||||
{
|
||||
return f(arg);
|
||||
}
|
||||
|
||||
int sfinae_test_f(int& i)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
struct X {};
|
||||
|
||||
int main()
|
||||
@@ -268,5 +289,10 @@ int main()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_RESULT_OF_USE_DECLTYPE)
|
||||
int i = 123;
|
||||
sfinae_test(sfinae_test_f, i);
|
||||
#endif // defined(BOOST_RESULT_OF_USE_DECLTYPE)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user