Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #86494

Re: string_view assignment from temporary ?

From Juha Nieminen <nospam@thanks.invalid>
Newsgroups comp.lang.c++
Subject Re: string_view assignment from temporary ?
Date 2022-09-22 11:17 +0000
Organization Aioe.org NNTP Server
Message-ID <tghg88$rh5$1@gioia.aioe.org> (permalink)
References <tghfoj$245l5$3@dont-email.me>

Show all headers | View raw


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()));

Back to comp.lang.c++ | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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