mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
Add StringRef::front (with some small tweaks while I was in the area).
- Patch by Erick Tryzelaar llvm-svn: 78883
This commit is contained in:
parent
11ee30bdc8
commit
791bb8ce44
@ -76,14 +76,21 @@ namespace llvm {
|
||||
|
||||
/// size - Get the string size.
|
||||
size_t size() const { return Length; }
|
||||
|
||||
/// front - Get the first character in the string.
|
||||
char front() const {
|
||||
assert(!empty());
|
||||
return Data[0];
|
||||
}
|
||||
|
||||
/// back - Get the last character in the string.
|
||||
char back() const {
|
||||
assert(!empty());
|
||||
return Data[Length-1];
|
||||
}
|
||||
|
||||
/// equals - Check for string equality, this is more efficient than
|
||||
/// compare() in when the relative ordering of inequal strings isn't needed.
|
||||
/// compare() when the relative ordering of inequal strings isn't needed.
|
||||
bool equals(const StringRef &RHS) const {
|
||||
return (Length == RHS.Length &&
|
||||
memcmp(Data, RHS.Data, RHS.Length) == 0);
|
||||
|
Loading…
Reference in New Issue
Block a user