|
Boost : |
From: Eric Niebler (eric_at_[hidden])
Date: 2003-11-21 12:04:45
James Curran wrote:
>
> This is not quite a slack as it needs to be, but it works:
>
> template <const char* exp>
> struct regexp
> {
> regexp() { cout << exp << endl; }
> };
>
> #define REGEXP(name, strng) \
> extern char __FILE__##name[] = strng; \
> typedef regexp<__FILE__##name> name;
>
> REGEXP(MyRegex, "(hello )+world")
>
> MyRegex rg;
>
Unfortunately, this doesn't buy you much. You can't parse the string at
compile time.
-- Eric Niebler 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