We provide non-explicit singleton constructors so users can pass in a "const char*" or a "string" wherever a "StringPiece" is expected.
| 50 | // in a "const char*" or a "string" wherever a "StringPiece" is |
| 51 | // expected. |
| 52 | StringPiece() : ptr_(nullptr), length_(0) { } |
| 53 | StringPiece(const char* str) // NOLINT implicit constructor desired |
| 54 | : ptr_(str), length_((str == nullptr) ? 0 : strlen(str)) { } |
| 55 | StringPiece(const std::string& str) // NOLINT implicit constructor desired |