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 02:42:35


On 06/12/2010 04:09 AM, Joel de Guzman wrote:
> On 6/12/10 5:13 AM, Andrey Semashev wrote:
>> On 06/11/2010 12:35 PM, Hartmut Kaiser wrote:
>>> 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?
>>
>> Well, I did so. It just so happens that I find myself replicating that
>> code in different places.
>>
>> I'm not very familiar with the standard specs on the new character types
>> but isn't there a strong relationship between the character type and
>> encoding? Can't we be sure that e.g. char16_t is UTF-16, char is the
>> standard narrow and wchar_t is the standard wide encoding?
>
> 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.


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