std:string
or std::string_view
is redundant CXX-C2023Initializing std::string
or std::string_view
with an empty string is unnecessary and can be considered redundant.
This is redundant because both types already have a default constructor that performs necessary initialization. Also, by removing the redundant initialization, the code becomes cleaner and more concise.
To fix this issue, simply remove the explicit initialization of the std::string
or std::string_view
with an empty string.
std::string str = "";
std::string_view str_view = "";
std::string str;
std::string_view str_view;