1

Topic: Line starve from function

Day kind! At me a simple question. Whether it is possible so to do, whether in sense safely so to return a line from functions? #include <iostream> #include "string" std:: string foo () {std:: string s = "la-la-la"; return s;} void main () {std:: string str = foo (); std:: cout <<str <<std:: endl;}

2

Re: Line starve from function

Hello.alex, you wrote: Yes. Generally there will be a copying. It is impossible to return only the link to a line in function.

3

Re: Line starve from function

Hello, Kernan, you wrote: K> Hello.alex, you wrote: K> Yes. Generally there will be a copying. It is impossible to return only the link to a line in function. Clearly. Thanks!

4

Re: Line starve from function

Hello, Kernan, you wrote: K> Generally there will be a copying. Most likely will not be, RVO works.

5

Re: Line starve from function

Hello, koenjihyakkei, you wrote: K> Hello, Kernan, you wrote: K>> Generally there will be a copying. K> most likely will not be, RVO works. Therefore I also specified that generally it will be copying.