From 95d04d0f5a55ca23f23db9923df27301107e4011 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Sat, 22 Feb 2003 21:38:38 +0000 Subject: [PATCH] Implementation of result_of<> as we're discussing it for the Bind proposal [SVN r1037] --- result_of_test.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 result_of_test.cpp diff --git a/result_of_test.cpp b/result_of_test.cpp new file mode 100644 index 0000000..a3034e0 --- /dev/null +++ b/result_of_test.cpp @@ -0,0 +1,34 @@ +#include +#include +#include +#include + +class int_result_type { typedef int result_type; }; + +class int_result_of +{ + template struct result_of { typedef int type; }; +}; + +class int_result_type_and_float_result_of +{ + typedef int result_type; + template struct result_of { typedef float type; }; +}; + +struct X {}; + +int main() +{ + using namespace boost; + + typedef int (*func_ptr)(float, double); + typedef int (X::*mem_func_ptr)(float); + + BOOST_STATIC_ASSERT((is_same::type, int>::value)); + BOOST_STATIC_ASSERT((is_same::type, int>::value)); + BOOST_STATIC_ASSERT((is_same::type, int>::value)); + BOOST_STATIC_ASSERT((is_same::type, int>::value)); + BOOST_STATIC_ASSERT((is_same::type, int>::value)); + return 0; +}