summaryrefslogtreecommitdiffstats
path: root/src/string_piece.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/string_piece.h')
-rw-r--r--src/string_piece.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/string_piece.h b/src/string_piece.h
index 031bda4..1c0bee6 100644
--- a/src/string_piece.h
+++ b/src/string_piece.h
@@ -17,8 +17,6 @@
#include <string>
-using namespace std;
-
#include <string.h>
/// StringPiece represents a slice of a string whose memory is managed
@@ -30,7 +28,7 @@ struct StringPiece {
StringPiece() : str_(NULL), len_(0) {}
/// The constructors intentionally allow for implicit conversions.
- StringPiece(const string& str) : str_(str.data()), len_(str.size()) {}
+ StringPiece(const std::string& str) : str_(str.data()), len_(str.size()) {}
StringPiece(const char* str) : str_(str), len_(strlen(str)) {}
StringPiece(const char* str, size_t len) : str_(str), len_(len) {}
@@ -38,14 +36,15 @@ struct StringPiece {
bool operator==(const StringPiece& other) const {
return len_ == other.len_ && memcmp(str_, other.str_, len_) == 0;
}
+
bool operator!=(const StringPiece& other) const {
return !(*this == other);
}
/// Convert the slice into a full-fledged std::string, copying the
/// data into a new string.
- string AsString() const {
- return len_ ? string(str_, len_) : string();
+ std::string AsString() const {
+ return len_ ? std::string(str_, len_) : std::string();
}
const_iterator begin() const {