Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #86496
| From | Juha Nieminen <nospam@thanks.invalid> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: string_view assignment from temporary ? |
| Date | 2022-09-22 12:36 +0000 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <tghks3$vfb$1@gioia.aioe.org> (permalink) |
| References | <tghfoj$245l5$3@dont-email.me> <tghg88$rh5$1@gioia.aioe.org> <tghjsa$24gv7$1@dont-email.me> |
Paavo Helde <eesnimi@osa.pri.ee> wrote:
> 22.09.2022 14:17 Juha Nieminen kirjutas:
>> Paavo Helde <eesnimi@osa.pri.ee> wrote:
>>> I just realized it is legal to assign a temporary std::string to a
>>> std::string_view
>>
>> I think there may be completely legitimate situations where you may want
>> to initialize a string_view with a temporary. Like:
>>
>> foo(std::string_view(bar()));
>
> Yes, I know. That's why my question was about assignment, not
> initialization.
std::string_view view;
foo(view = bar());
Isn't that completely normal code? :P
Back to comp.lang.c++ | Previous | Next — Previous in thread | Find similar | Unroll thread
string_view assignment from temporary ? Paavo Helde <eesnimi@osa.pri.ee> - 2022-09-22 14:09 +0300
Re: string_view assignment from temporary ? Juha Nieminen <nospam@thanks.invalid> - 2022-09-22 11:17 +0000
Re: string_view assignment from temporary ? Paavo Helde <eesnimi@osa.pri.ee> - 2022-09-22 15:19 +0300
Re: string_view assignment from temporary ? Juha Nieminen <nospam@thanks.invalid> - 2022-09-22 12:36 +0000
csiph-web