|
Boost Users : |
From: Carlo Wood (carlo_at_[hidden])
Date: 2006-05-09 19:33:32
On Tue, May 09, 2006 at 02:38:10PM -0400, Stephen Gross wrote:
> I just found out about the typeof feature in g++. I'm trying to use the type
> returned by a boost::bind invocation. Is there any way to make the following
> work:
>
> ===============================
> struct A { int foo(); }
> typedef typeof(boost::bind(A::foo)) my_type;
> ===============================
>
> So far, g++ just seg faults on me. Am I doing something horribly wrong, or
> is this (more likely) not possible in the first place?
What version of g++ is that? I tried:
2.95.2 19991024 (release)
2.95.3 20010315 (release)
2.96 20000731 (Red Hat Linux 7.3 2.96-110)
3.1
3.1.1
3.2
3.2.1
3.2.2
3.2.3
3.3
3.3.1
3.3.2
3.3.3
3.3.4
3.3.5
3.4.0
3.4.1
3.4.2
3.4.3
3.4.4
4.0.0
4.0.1
4.0.2
4.1.0 20051026 (experimental)
None of those core.
I did add a semicolon after the struct however - I assume you at least
did that correct.
If you also add a '&' in front of the function pointer, and add '_1' as
second parameter to boost::bind, then all compiler versions compile it
without errors or warnings, with the exception of g++ 3.2.
(Imho, any version < 3.3.2 is too broken to support at all, but ok).
-- Carlo Wood <carlo_at_[hidden]>
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