Boost logo

Boost Users :

From: Pavol Droba (droba_at_[hidden])
Date: 2008-01-17 10:30:33


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.

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