mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
add ::drop_back() and ::drop_front() methods, which are like pop_front/pop_back on a vector, but a) aren't destructive to "this", and b) can take a # elements to drop.
llvm-svn: 148791
This commit is contained in:
parent
e9cf212d3f
commit
1c091db526
@ -353,6 +353,20 @@ namespace llvm {
|
||||
Start = min(Start, Length);
|
||||
return StringRef(Data + Start, min(N, Length - Start));
|
||||
}
|
||||
|
||||
/// drop_front - Return a StringRef equal to 'this' but with the first
|
||||
/// elements dropped.
|
||||
StringRef drop_front(unsigned N = 1) const {
|
||||
assert(size() >= N && "Dropping more elements than exist");
|
||||
return substr(N);
|
||||
}
|
||||
|
||||
/// drop_back - Return a StringRef equal to 'this' but with the last
|
||||
/// elements dropped.
|
||||
StringRef drop_back(unsigned N = 1) const {
|
||||
assert(size() >= N && "Dropping more elements than exist");
|
||||
return substr(0, size()-N);
|
||||
}
|
||||
|
||||
/// slice - Return a reference to the substring from [Start, End).
|
||||
///
|
||||
|
Loading…
x
Reference in New Issue
Block a user