Boost logo

Boost :

Subject: Re: [boost] [spirit2] How to get encoding-specific parsers by character type
From: Hartmut Kaiser (hartmut.kaiser_at_[hidden])
Date: 2010-06-11 04:35:51


> I was wondering if it was possible to get encoding-specific parsers by
> character type? Something like that:
>
> template< typename CharT >
> struct encoding_specific
> {
> ...
> };
>
> typedef encoding_specific< char > narrow;
> narrow::char_; // equivalent to spirit::standard::char_
>
> typedef encoding_specific< wchar_t > wide;
> wide::char_; // equivalent to spirit::standard_wide::char_
>
> This would help a lot in generic programming, when the character type is
> not known. Is there a tool like that already? If not, could it be added?

There isn't anything like that. The reason is that usually you want to
specify a character set in addition to the character type to use. So the
solution above is nothing I would like to see in Spirit, even if it might be
sufficient for your particular case. OTOH, if it is sufficient for you why
don't you just add it inside your namespace and be done?

Regards Hartmut

---------------
Meet me at BoostCon
www.boostcon.com


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