//===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // reference_wrapper // has weak result type #include #include class functor1 : public std::unary_function { }; class functor2 : public std::binary_function { }; class functor3 : public std::unary_function, public std::binary_function { public: typedef float result_type; }; class functor4 : public std::unary_function, public std::binary_function { public: }; class C {}; template struct has_result_type { private: struct two {char _; char __;}; template static two test(...); template static char test(typename U::result_type* = 0); public: static const bool value = sizeof(test(0)) == 1; }; int main() { static_assert((std::is_same::result_type, char>::value), ""); static_assert((std::is_same::result_type, double>::value), ""); static_assert((std::is_same::result_type, float>::value), ""); static_assert((std::is_same::result_type, void>::value), ""); static_assert((std::is_same::result_type, int*>::value), ""); static_assert((std::is_same::result_type, void>::value), ""); static_assert((std::is_same::result_type, int*>::value), ""); static_assert((std::is_same::result_type, int*>::value), ""); static_assert((std::is_same::result_type, int>::value), ""); static_assert((std::is_same::result_type, C>::value), ""); static_assert(has_result_type >::value, ""); static_assert(!has_result_type >::value, ""); static_assert(!has_result_type >::value, ""); }