a question on boost::is_function

should the following code return: true or false? boost::is_function<int (*)(int)>::value if the result is false, why? I don't understand it. if the result is true, the code of boost_1_32_0/libs/type_traits/test/is_function_test.cpp line 42 expect it to be false. could someone help me with this? ----------------------------------------- This message and its attachments may contain privileged and confidential information. If you are not the intended recipient(s), you are prohibited from printing, forwarding, saving or copying this email. If you have received this e-mail in error, please immediately notify the sender and delete this e-mail and its attachments from your computer.

On Jan 5, 2005, at 11:12 AM, Kevin Lee wrote:
should the following code return: true or false?
boost::is_function<int (*)(int)>::value
if the result is false, why? I don't understand it.
It should be false. You're passing in a function pointer type, not a function type. The following would be true: boost::is_function<int(int)>::value Doug

Kevin Lee wrote:
should the following code return: true or false?
boost::is_function<int (*)(int)>::value
false.
if the result is false, why? I don't understand it.
That's a pointer-to-function type, not a function type. Try boost::is_function<int(int)>::value I know it's confusing. Most C++ programmers never see a function type in the wild. You can use remove_pointer to turn a pointer-to-function into a function. -- Dave Abrahams Boost Consulting http://www.boost-consulting.com

On Jan 5, 2005, at 11:12 AM, Kevin Lee wrote:
should the following code return: true or false?
boost::is_function<int (*)(int)>::value
if the result is false, why? I don't understand it. if the result is true, the code of boost_1_32_0/libs/type_traits/test/is_function_test.cpp line 42 expect it to be false.
could someone help me with this?
int (*)(int) is a pointer, not a function. boost::is_pointer<int (*)(int)>::value should be true. Also is_function<int (int)>::value should be true. And is_function<:remove_pointer<int (*)(int)>::type>::value should also be true. -Howard
participants (4)
-
David Abrahams
-
Douglas Gregor
-
Howard Hinnant
-
Kevin Lee