Subject: Re: [boost] [c++TR2] N3334, Proposing array_ref<T> and string_ref
From: Olaf van der Spek (ml_at_[hidden])
Date: 2012-01-30 18:34:20
On Mon, Jan 30, 2012 at 3:20 PM, Beman Dawes <bdawes_at_[hidden]> wrote:
> One of my blink reactions is that array_ref<T> and
> basic_string_ref<charT, traits> are range generators and I was a bit
> surprised to see the implementation was a pointer and length rather
> than two pointers. Or better yet, two iterators or an explicit range
> component. With iterators, a basic_string_ref could do encoding
> conversions on-the-fly without need of temporary strings. But I have
> no idea if that is workable or actually is better.
> What do other Boosters think?
I think the idea is great. In fact, I've written similiar classes:
I've posted about the idea on this list before, but received few responses.
The idea is that you've got a non-template function that takes an
array. Often types used are (const void*, size_t) or (const char*,
size_t), which is cumbersome.
Iterators instead of pointers wouldn't really work.
std::string with small string optimizations is sub-optimal if input is
not an std::string, but for example std::array.
N3334 does not really address the (const void*, size_t) case.
BTW, isn't there a forum / mailing list to discuss these proposals?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk