Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-11-19 04:09:26


"Brock Peabody" <brock.peabody_at_[hidden]> writes:

>> -----Original Message-----
>> From: boost-bounces_at_[hidden] [mailto:boost-bounces_at_[hidden]]
>> On Behalf Of Brian McNamara
>
>
>> <wishful thinking>
>>
>> If only "strings" were legal "template value parameters" in C++. Then
>> we could write code like
>>
>> typedef regexp< "(hello )+world" >::type MyRegex;
>> ... MyRegex::match( someString ) ...
>>
>> Aaaaaah. :)
>>
>> </wishful>
>
> If you don't mind pain you could have:
>
> typedef regexp<vector_c<
> char,
> '(','h','e','l','l','o',' ',')','+','w','o','r','l','d'
> > >::type MyRegex;

For a bit less pain, there's always

   typedef regexp<vector_c<
      long,
      '(hel','lo )','+wor','ld'
> >::type MyRegex;

But I think the whole point of xpressive is to avoid pain ;-)

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk