Subject: Re: [boost] [typeof] 2 questions
From: Daniel Walker (daniel.j.walker_at_[hidden])
Date: 2010-05-17 21:12:51
On Sun, May 16, 2010 at 3:23 PM, Eric Niebler <eric_at_[hidden]> wrote:
> Resending. Is Boost.Typeof actively maintained? I can submit a patch for
> the first issue below, but decltype support should probably be added by
> someone who knows the library better.
I'm not sure if Boost.Typeof is being actively maintained, but I agree
that the first issue should be fixed. If you have a patch for it
that's great. decltype support may introduce some minor backwards
> On 5/11/2010 7:48 AM, Eric Niebler wrote:
>> 1) Some compilers don't support typeof in any form, even emulated. From
>> looking at typeof.hpp, it looks like just #include'ing typeof.hpp on
>> those compilers results in a hard error. I'd like a way to test whether
>> typeof is supported and use it if so, otherwise do something else. How
>> can I do that?
>> 2) I can't find "decltype" by grepping the typeof code. Why doesn't
>> typeof use the decltype keyword on compilers that support it?
I think there are some differences. As I recall, typeof doesn't
preserve references whereas decltype does, so existing code could be
broken in some situations. But I second you're suggestion of migrating
to decltype where available/possible.
>> And I lied. I have another question. How expensive at compile-time is
>> emulated typeof?
Not sure. I think it may vary depending on whether it's called with a
user defined/registered class or a primitive type.