Boost logo

Boost Users :

Subject: Re: [Boost-users] [xpressive] Shouldn't external placeholder variables allow consts?
From: Ami Ganguli (ami.ganguli_at_[hidden])
Date: 2009-10-12 11:26:47


Done:
   https://svn.boost.org/trac/boost/ticket/3519

Cheers,
Ami.

On Mon, Oct 12, 2009 at 5:47 PM, Eric Niebler <eric_at_[hidden]> wrote:
> Ami Ganguli wrote:
>>
>> I came across an interesting problem:
>>
>>   what.let(_placeholder = this);
>>
>> fails to compile, because 'this' is a const pointer.
>>
>> A simple workaround:
>>
>>   MyClass *_this = this;
>>   what.let(_placeholder = _this);
>>
>> But surely this shouldn't be necessary?  Couldn't the right hand side
>> of the let be declared const?
>
> Interesting! Yes, the placeholder code in xpressive seems to assume that the
> rhs of the let expression is a non-const lvalue. That's certainly not the
> case for "this". But even code as simple as this fails to compile:
>
>    placeholder<int> _i;
>    smatch what;
>    what.let(_i = 1);
>
> I'm not quite sure how to handle this at the moment. What should happen with
> actions like "[ _i += 1 ]" if "_i" ends up bound to something that isn't a
> mutable lvalue? It's possible that we need a way to specify a placeholder
> for non-mutable data. Maybe this:
>
>    placeholder<int const> _i;
>
> ... and now an action like "[ _i += 1 ]" can be made to fail at compile
> time.
>
> You should open a ticket for this: http://svn.boost.org. Thanks.
>
> --
> Eric Niebler
> BoostPro Computing
> http://www.boostpro.com
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>


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