SFINAE enabled result_of fixes [7343]

[SVN r80605]
This commit is contained in:
Daniel Walker
2012-09-19 23:10:08 +00:00
parent b6a55f878c
commit ac9f617f7f
3 changed files with 107 additions and 3 deletions
+26
View File
@@ -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;
}