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?Feedba...
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
string {...}; extern const char some_string[] ={"abcd efg..."};
typedef 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