Boost logo

Boost Users :

From: shunsuke (pstade.mb_at_[hidden])
Date: 2008-01-17 07:38:06


Pavol Droba wrote:
>>> Since as_literal is used quite some time already, I don't see any
>>> compelling reason to rename it.
>> I agree as_literal can't be renamed.
>> Now we have to look for a new name?
>> `SIZE(as_???("ab\0c")) == 4`
>>
>> as_??? returns in constant time.
>> I don't find the name yet. :-)
>>
>
> I'm not sure if this case is important enough to get special as_XXX
> threatment.
>
> IMHO if you need nulls inside a string, you should use std::string or
> just a plain array. literal with null is dangerous at least.

\0 is not so important in this case.
iterator_range<char const*> r = as_literal("million characters which contains no null...");
incurs significant overhead even if you know the string contains no null.

Regards,

-- 
Shunsuke Sogame

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