Boost logo

Boost :

Subject: Re: [boost] Heads up - string_ref landing
From: Peter Dimov (lists_at_[hidden])
Date: 2012-11-16 13:16:14


Jeffrey Lee Hellrung, Jr. wrote:

> ... I haven't read the C++ proposal ...

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3442.html

> For one, it would provide a single implementation of a contiguous range of
> char, char const, unsigned char, unsigned char const, wchar_t, and wchar_t
> const.

It does.

> But there's nothing inherently string-like about that design;

There are a number of very string-like things about the design.

> Lastly, and I don't know how big a deal this is, but one could write more
> tailored range algorithms for contiguous_ranges of POD types (using
> std::memcpy or std::memset, for example, which may produce more optimal
> code (?) than std::copy or std::fill, resp.). So I can see a plausible
> advantage in having a single template class abstracting contiguous ranges.

To do this, you should accept an arbitrary Range and check a trait
(is_contiguous), not hardcode contiguous_range<> (for instance, std::vector
isn't contiguous_range<>, bit it is a contiguous range).


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