|
Boost Users : |
From: Pavol Droba (droba_at_[hidden])
Date: 2008-01-17 07:06:18
shunsuke wrote:
> Pavol Droba wrote:
>> shunsuke wrote:
>>> Pavol Droba wrote:
>>>> Hi,
>>>>
>>>> shunsuke wrote:
>>>>> Pavol Droba wrote:
>>>>>> Not necessary. Why couldn't we take the whole array as a string when no
>>>>>> null character is present?
>>>>> It means as_literal will not have constant complexity?
>>>>>
>>>> as_literal doesn't have contant complexity even now, since it works with
>>>> c-strings. It has constant complexity only in case of arrays and that's
>>>> only because the implementation is wrong.
>>> If so, as_literal should have been named as "as_c_str", IMO.
>>>
>> 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.
Regards,
Pavol.
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