Typedef equivalence in function arguments?

Your problem is that const typename T::value_type is basically typename T::value_type const which resolves to O* const which is obviously not the same as const O (which would be O const when writing the ptr declaration behind the type (more useful to figure out this behaviour)).

Your problem is that const typename T::value_type is basically typename T::value_type const which resolves to O* const which is obviously not the same as const O* (which would be O const *, when writing the ptr declaration behind the type (more useful to figure out this behaviour)). As for archiving what you want, that entirly depends on what you want. If you want you can use boost type_traits or tr1 type_traits to strip the pointer, add const and make it a pointer again like this: template void function2(void (C::*callback)(typename boost::add_pointer::type>::type>::type)); Using tr1 instead of boost should basically be a matter of replacing boost:: with std::tr1::.

However I wouldn't exactly call this a useful generalization, so you might want to overthink if you really want to go that way. Personally I would either use something like boost function or free functions as callbacks, the former allowing for much greater flexibility in what can be used as callbacks (free functions, functors, member functions), while the later at least makes it easy to create a second function which will appropriately convert the arguments (that is if you want to use a function which gets const O* as parameter, you can create one which takes O* and calls the first one with that parameter and use that one as callback).

A member function pointer whose target is the same as the caller only needs &C::print. A boost::function needs boost::bind(&C::print, this). So it's "easier".

Moreover, it wouldn't solve anything since the callback still needs an argument whose type is depending on the template typename. – Warren Seine Jan 18 at 12:16.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions