Boost logo

Boost Users :

Subject: Re: [Boost-users] [mpl]... is there an mpl::string
From: Eric Niebler (eric_at_[hidden])
Date: 2009-04-08 13:51:41


Ovanes Markarian wrote:
> Eric Niebler wrote:
>> You mean, how did I discover the nature of the
>> implementation-defined behavior for each compiler? It wasn't by
>> reading any docs. I just played around with various compilers until
>> I found what worked. I found some compiler bugs in the process,
>> too. See:
>>
>> https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=334208
>
> Interesting. Ok, but if a string maps to an integer it means that I
> can only pass 4 characters at once on a 32bit platform???

Strings don't map to integers. Multicharacter literals do. And yes, that
means in general that you can only reliably count on being able to
encode a 4 char sequence in a multicharacter literal.

> I just looked over your tests and did not get immediately that these
> all use char test sequences.

I don't follow you.

> I used a slightly different approach in my previous use case.
>
> template<char const* Str> string {...};
>
> extern const char some_string[] ={"abcd efg..."};
>
> typedef string<some_string> my_string_type;

Sure, but that gets hard to use, and you can't use this to compute new
strings at compile time.

> Would be cool to find a solution of really passing strings like:
>
> typedef string<"abcd efg.."> some_other_type;

And if wishes were fishes we'd all cast nets. ;-)

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net