C++ Logo

std-discussion

Advanced search

Re: objects with no lifetime for validation

From: Federico Kircheis <federico_at_[hidden]>
Date: Sat, 27 May 2023 08:23:16 +0200
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.

>
>> It just came to my mind that it would be possible to misuse volatile
>
> Please, no.

Well, there is a reason I did not lists the myriad of issues with this
approach ;-)

I just listed here as possible alternative to comments/convention like
Hungarian notation, as it more or less does what I would like to.

> Jens

Received on 2023-05-27 06:23:25