We provide non-explicit singleton constructors so users can pass in a "const char*" or a "string" wherever a "StringPiece" is expected.
| 56 | // in a "const char*" or a "string" wherever a "StringPiece" is |
| 57 | // expected. |
| 58 | StringPiece() |
| 59 | : data_(NULL), size_(0) {} |
| 60 | #if __has_include(<string_view>) && __cplusplus >= 201703L |
| 61 | StringPiece(const std::string_view& str) |
| 62 | : data_(str.data()), size_(str.size()) {} |