How to allow a std:string parameter to be NULL?

Viewed 5249

I have a function foo(const std::string& str); that it does crash if you call it using foo(NULL).

What can I do to prevent it from crashing?

3 Answers
Related