Subject: Re: [Boost-bugs] [Boost C++ Libraries] #12980: compile time character array
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-04-20 15:18:48
#12980: compile time character array
-------------------------------+--------------------------
Reporter: gast128@⦠| Owner: marshall
Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: utility
Version: Boost 1.63.0 | Severity: Optimization
Resolution: | Keywords:
-------------------------------+--------------------------
Changes (by marshall):
* owner: no-maintainer => marshall
Comment:
As you note, we've been down this rathole before.
You can pass pointer and length; there's a constructor for that.
And then there's the whole "trailing null" issue:
{{{
const char arr1 [] = { 'H', 'e', 'l', 'l', 'o' };
const char arr2 [] = "Hello";
const char p1 = "Hello";
}}}
If you make a `string_view` from `arr1`, its `size()` should be five,
because there are five characters in the array.
If you make a `string_view` from `p1`, its `size()` should be five,
because that's what `traits::length` returns.
What about `arr2`? Should it be 6, since there are six characters in the
array? Or 5, since the last character is a NUL?
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/12980#comment:1> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-04-20 15:22:55 UTC