|
Boost Users : |
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2008-01-18 03:27:32
Pavol Droba skrev:
>
> shunsuke wrote:
>> 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.
>>
>
> Well, if the performance is the problem, you can always construct the
> range manually. In this case it could be done in compile time.
>
> This is a special case and I don't think, that it needs to be handled on
> the generic library level.
>
> But at the end, as_literal is a part of range library, so it is up to
> Thorsten to decide.
I don't have good opinion on this, since I haven't used embedded null's
very frequently (never actually).
I think I'm leaning towards the "just make it work" camp, even if it
produces non-optimal code.
The question remains then if we should add another function to get the
current behavior. I don't really care yet.
-Thorsten
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