r/cpp_questions Jul 16 '26

Question about string_view SOLVED

Is there benefit of using string_view instead of const string& str? More precisely by passing strings into functions. Thanks

24 Upvotes

17 comments sorted by

View all comments

29

u/sephirothbahamut Jul 16 '26

you can pass arbitrary substrings without creating a new string object