Safely passing strings and string_views -- Niek J Bouman

Passing a string temporary into a string_view can make the latter dangling 

Safely passing std::strings and std::string_view

by Niek J Bouman

From the article:

Many of you will agree that C++ is a language that comes with sharp edges. One example is `std::string_view`; introduced as a type to prevent unnecessary std::string-copies, but it introduces a new footgun, namely when passing a temporary string into it:

Add a Comment

You must sign in or register to add a comment.

Comments (0)

There are currently no comments on this entry.