Boost logo

Boost :

Subject: Re: [boost] [spirit2] How to get encoding-specific parsers by character type
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2010-06-12 07:03:20

On 06/12/2010 02:00 PM, Joel de Guzman wrote:
>>> I don't think so. I use char/UTF-8 a lot now; I don't want char to be
>>> tied
>>> to standard narrow.
>> Ok, what about specifying encoding tag then?
>> template< typename EncodingTagT >
>> struct encoding_specific
>> {
>> ...
>> };
>> I could create my traits to deduce the default encoding by the character
>> type for my case.
> I'm sorry, you lost me. Could you please elaborate?

What I want to be able to do is something like that:

   template< typename CharT >
   void parse(const CharT* str)
     typedef typename my_traits< CharT >::encoding encoding;
     typedef spirit::encoding_specific< encoding > parsers;
     qi::parse(str, *parsers::char_);

The encoding type shall be one of the tags defined by spirit (for
instance, spirit::char_encoding::standard). What I need is the
encoding_specific traits in spirit.

Boost list run by bdawes at, gregod at, cpdaniel at, john at