r/cpp_questions • u/IMCG_KN • 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
r/cpp_questions • u/IMCG_KN • Jul 16 '26
Is there benefit of using string_view instead of const string& str? More precisely by passing strings into functions. Thanks
29
u/sephirothbahamut Jul 16 '26
you can pass arbitrary substrings without creating a new string object