Boost logo

Boost Users :

Subject: Re: [Boost-users] [xpressive] static expression adding
From: Eric Niebler (eric_at_[hidden])
Date: 2009-02-12 10:48:35


Jan Boehme wrote:
> Hi,
>
> is it possible to add an expression to an already existing expression object?
>
> Something like:
>
> sregex re = '$' >> +_d >> '.' >> _d >> _d;
>
> replace by:
>
> sregex re = '$';
> re += +_d;
> re += '.' >> _d >> _d;
>
> My attempts did result in compile time troubles.

You can nest regular expressions to get the same behavior.

sregex re0 = as_xpr('$');
sregex re1 = re0 >> +_d;
sregex re2 = re1 >> '.' >> _d >> _d;

You lose most of the benefits of static regular expressions when you do
this, though.

HTH,

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com

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