| 101 | } |
| 102 | |
| 103 | int compare(const StringPiece& x) const { |
| 104 | int r = memcmp(ptr_, x.ptr_, std::min(length_, x.length_)); |
| 105 | if (r == 0) { |
| 106 | if (length_ < x.length_) r = -1; |
| 107 | else if (length_ > x.length_) r = +1; |
| 108 | } |
| 109 | return r; |
| 110 | } |
| 111 | |
| 112 | std::string as_string() const { |
| 113 | return std::string(data(), size()); |
no outgoing calls