[xpressive] static expression adding
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. Thanks for helping, Jan.
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
"Eric Niebler"
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.
You can also use BOOST_PROTO_AUTO if you have a sub-expression that's used a
lot.
You have to include header
participants (3)
-
Dave Jenkins
-
Eric Niebler
-
Jan Boehme