Boost logo

Boost Users :

From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2008-06-19 04:47:57

David Abrahams skrev:
> on Wed Jun 18 2008, Raider <> wrote:
>> Can anyone tell why boost 1.35 dropped support of boost::begin()/end()
>> for zero terminated strings (const char*/wchar_t*)?

> You might ask why we didn't make it so that char(&)[N] was interpreted
> as an array of length N but char* was interpreted as a null-terminated
> string that only has forward iterators (to avoid O(N) "random access"
> operations, which are also evil in generic code)... I'm not entirely
> sure of the answer to that.

We believed that support for null-terminated strings would belong in
string focused libraries. The function as_literal() was added for that
purpose (so just use this function if you use BOOST_FOREACH with char*

I guess we could define the iterator type of char* to be some forward
iterator, but I'm not sure how useful that really is.


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at