I was surprised that the following code compiled:
#include
Sean Huang wrote:
Is there any reason why boost::function allows such conversions?
Boost.Function tries to behave as if it were a function pointer. And like all pointers, function pointers can be assigned an integral constant with the value 0, resulting in a null pointer. Thus, you can assign 0 and char() to a Boost.Function. Sebastian Redl
----- Original Message -----
From: "Sebastian Redl"
Sean Huang wrote:
Is there any reason why boost::function allows such conversions?
Boost.Function tries to behave as if it were a function pointer. And like all pointers, function pointers can be assigned an integral constant with the value 0, resulting in a null pointer. Thus, you can assign 0 and char() to a Boost.Function.
Now I see as long as boost::function allows assignment (or copy construction) from a function pointer, this conversion is always valid. Thanks, Sean
participants (2)
-
Sean Huang
-
Sebastian Redl