Boost logo

Boost Users :

From: Pavel Antokolsky aka Zigmar (zigmar_at_[hidden])
Date: 2007-01-25 04:26:46


Hi, Tobias. Thanks for your answer

On 1/24/07, Tobias Schwinger <tschwinger_at_[hidden]> wrote:
> First of all, you really shouldn't be using anything in 'detail'
> namespaces -- what's in there are implementation details which a) might
> be removed at any time b) might be changed to behave differently at any
> time c) might even be defined differently or not at all for some compilers.
Sure, I know. I didn't use it in production of course, but I played
with it trying to pin down the problem.

> 'T' is deduced to a function /pointer/. You have to use the plain
> function type (without the pointer on top) for 'function_traits' to work:
>
> typedef typename boost::function_traits<
> typename boost::remove_pointer<T>::type >::result_type X;
Ah, thanks. That what I've been missing. I can of course
"remove_pointer", but what I'm wandering, is why the function_traits
tries to add pointer in a first place? Besides, it seems relatively
easy to detect if type is pointer or not, and make function_traits to
work with both...

> Note that 'function_traits' won't work with function objects (that is
> clases with an overloaded operator()). Guessing from the code you posted
> you might be better off using Boost.ResultOf:
>
> http://www.boost.org/libs/utility/utility.htm#result_of
Thanks. It looks like nice solution, but unfortunately it is not
available in the boost version I'm using (1.30).

> Further, a library that provides a more complete set of traits classes
> entirely dedicated to built-in functional types (and pointers/references
> thereof) has been accepted into Boost, recently.
Thats a cool library, I agree. But again, it is not currently
available in my version, and it would be overkill in terms of
management to introduce a library that is not currently part of the
boost for relatively simple functionality I need.

-- 
Best regards,
Zigmar

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net