mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
StringRef: Add comparison operators against const char*.
This commit is contained in:
@@ -604,6 +604,54 @@ namespace wpi {
|
||||
return LHS.compare(RHS) != -1;
|
||||
}
|
||||
|
||||
inline bool operator==(StringRef LHS, const char *RHS) noexcept {
|
||||
return LHS.equals(StringRef(RHS));
|
||||
}
|
||||
|
||||
inline bool operator!=(StringRef LHS, const char *RHS) noexcept {
|
||||
return !(LHS == StringRef(RHS));
|
||||
}
|
||||
|
||||
inline bool operator<(StringRef LHS, const char *RHS) noexcept {
|
||||
return LHS.compare(StringRef(RHS)) == -1;
|
||||
}
|
||||
|
||||
inline bool operator<=(StringRef LHS, const char *RHS) noexcept {
|
||||
return LHS.compare(StringRef(RHS)) != 1;
|
||||
}
|
||||
|
||||
inline bool operator>(StringRef LHS, const char *RHS) noexcept {
|
||||
return LHS.compare(StringRef(RHS)) == 1;
|
||||
}
|
||||
|
||||
inline bool operator>=(StringRef LHS, const char *RHS) noexcept {
|
||||
return LHS.compare(StringRef(RHS)) != -1;
|
||||
}
|
||||
|
||||
inline bool operator==(const char *LHS, StringRef RHS) noexcept {
|
||||
return StringRef(LHS).equals(RHS);
|
||||
}
|
||||
|
||||
inline bool operator!=(const char *LHS, StringRef RHS) noexcept {
|
||||
return !(StringRef(LHS) == RHS);
|
||||
}
|
||||
|
||||
inline bool operator<(const char *LHS, StringRef RHS) noexcept {
|
||||
return StringRef(LHS).compare(RHS) == -1;
|
||||
}
|
||||
|
||||
inline bool operator<=(const char *LHS, StringRef RHS) noexcept {
|
||||
return StringRef(LHS).compare(RHS) != 1;
|
||||
}
|
||||
|
||||
inline bool operator>(const char *LHS, StringRef RHS) noexcept {
|
||||
return StringRef(LHS).compare(RHS) == 1;
|
||||
}
|
||||
|
||||
inline bool operator>=(const char *LHS, StringRef RHS) noexcept {
|
||||
return StringRef(LHS).compare(RHS) != -1;
|
||||
}
|
||||
|
||||
inline std::string &operator+=(std::string &buffer, StringRef string) {
|
||||
return buffer.append(string.data(), string.size());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user