Boost logo

Boost :

From: Justinas V.D. (vygintas.daugmaudis_at_[hidden])
Date: 2004-05-04 15:54:53


> //test_array_functions( a ); // Does NOT compile with gcc
> test_array_functions<int_array>( a );

I have quite similar problem, actually. GCC does not allow implicit
type conversions in somewhat complex function overloads. This can really
be quite annoying. And there boost::get_pointer comes to mind.

Question to Peter Dimov. Is it possible and rational to modify code in
mem_fn_template.hpp so that
get_pointer(u) would be called as get_pointer<U>(u) ?

I believe this should not brake existing code, on the other hand, it
would be easier to provide so-needed get_pointer overloads.

Actually, my problem is:

I have, say, type T, and I'd like to write an implicit converter to
templatized type Y so that:
T::value_type * get_pointer(const Y<T> &p). Of course, all required
enable_ifs are applied so that this overload is not visible for other
types that do not meet some certain archetype.

Then invocation of function get_pointer would create temporary object of
type Y<T> which would be destroyed on exit from method call scope. That
would be fine because in my case, Y c-tor locks mutex and d-tor -
unlocks mutex.

This would allow type T<A> to model pointers to A and create thread-safe
bind functors.

Another alternative I have is to specialize mf0, cmf0, .... etc.
(partial function specializations are still non-existant). But this is
unacceptable, I think.

Justinas V.D.

Boost list run by bdawes at, gregod at, cpdaniel at, john at