Subject: Re: [boost] Heads up - string_ref landing
From: Sergey Cheban (s.cheban_at_[hidden])
Date: 2012-12-06 08:18:19
On 28.11.2012 14:48, Rob Stewart wrote:
> OK, I suspect we're agreeing more than disagreeing. Here's the I/F of my string_ref:
> - converting ctors from:
> o char const *
> o std::string const &
> o std::vector<char> const &
> o const_substring const & (my substring type)
> - other ctors:
What about default constructor?
> o char const *, size_t
> o char const *, char const *
> o char const (&)[N]
May be, it is reasonable to add bool trim_last = true here? This would
allow not null-terminated character arrays.
> - similar assignment operators
> - similar assign() member functions
> - bool is_null()
I propose empty() instead. I don't think that the substring (and
especially string_REF) may be "null".
> - safe bool or explicit bool conversion operator
I don't think this is a good idea.
> - char const * data()
> - size_t length()
I propose the alias size().
> - char const * begin()/end()
> - string_ref substr()
> - char operator(size_t)
Throwing at() may be useful, too.
> (I think that's a complete list. I'm doing it from memory now.)
What about pop_back(), pop_front(), swap()?
And again, I propose "substring" instead of "string_ref".
-- Sergey Cheban
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk