Date: Sat, 27 May 2023 16:13:46 +0200
On 27/05/2023 15.32, Jason McKesson via Std-Discussion wrote:
> On Sat, May 27, 2023 at 2:23 AM Federico Kircheis via Std-Discussion
> <std-discussion_at_[hidden]> wrote:
>>
>> On 27/05/2023 07.56, Jens Maurer wrote:
>>>
>>>
>>> On 27/05/2023 07.36, Federico Kircheis via Std-Discussion wrote:
>>>> Creating a view_data like
>>>>
>>>> struct data_view{
>>>> span<string_view> otherdata;
>>>> }
>>>>
>>>> wont work, as span<string_view> cannot point to vector<string>
>>>
>>> But a vector<string_view> can point to the individual elements
>>> of a vector<string>.
>>
>> But this means creating a new vector.
>> Plus duplicating classes.
>
> There's no other way to have a bunch of string_views when that's not
> what you started with. A string isn't a string_view, and no
> reinterpret_cast gymnastics can even *theoretically* make that work.
Yes, exactly my point, which is why I wrote
"string_view helps to avoid having a measurable overhead, but for more
complex datatypes, it is not always feasible to write a corresponding
view type"
> On Sat, May 27, 2023 at 2:23 AM Federico Kircheis via Std-Discussion
> <std-discussion_at_[hidden]> wrote:
>>
>> On 27/05/2023 07.56, Jens Maurer wrote:
>>>
>>>
>>> On 27/05/2023 07.36, Federico Kircheis via Std-Discussion wrote:
>>>> Creating a view_data like
>>>>
>>>> struct data_view{
>>>> span<string_view> otherdata;
>>>> }
>>>>
>>>> wont work, as span<string_view> cannot point to vector<string>
>>>
>>> But a vector<string_view> can point to the individual elements
>>> of a vector<string>.
>>
>> But this means creating a new vector.
>> Plus duplicating classes.
>
> There's no other way to have a bunch of string_views when that's not
> what you started with. A string isn't a string_view, and no
> reinterpret_cast gymnastics can even *theoretically* make that work.
Yes, exactly my point, which is why I wrote
"string_view helps to avoid having a measurable overhead, but for more
complex datatypes, it is not always feasible to write a corresponding
view type"
Received on 2023-05-27 14:13:57