Boost logo

Boost :

Subject: Re: [boost] Data / String Ref library
From: Yakov Galka (ybungalobill_at_[hidden])
Date: 2011-03-29 13:07:04


On Tue, Mar 29, 2011 at 18:47, Olaf van der Spek <olafvdspek_at_[hidden]>wrote:

> On Tue, Mar 29, 2011 at 5:40 PM, Yakov Galka <ybungalobill_at_[hidden]>
> wrote:
> > You already can use boost::iterator_range<const char*>.
>
> It doesn't provide the interface const std::string& provides and it
> doesn't solve the case for const void* (I think).
>
>
> --
> Olaf
>

boost::iterator_range<const char*> is a sequence of bytes/chars, that is
what pair<const void*,size_t> represents. It solves this case completely,
but only that case.

The reason it doesn't solve the const std::string& case is because there is
no consensus of what interface std::string should have (see recent string
discussions from about two months ago). As per the current std::string
non-mutable interface, it includes only the find.* family of functions,
substr, compare and c_str. Most of these are already handled by Boost.String
and Boost.Range. They can work with interator_range transparently. The only
problem is c_str, which I don't know how you want to implement it for
string_ref anyway.

-- 
Yakov

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk