void foo(std::string a) {}
void foo(const char *a) {}
void foo(llvm::StringRef a) {}
void foo(std::string_view a) {}
The first one will do a memory allocation to copy the string. The last three are semantically the same. The difference is style and different C++ standards.