mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-19 06:31:18 +00:00
Add ImmutableList::contains(). Patch by Rui Paulo!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134545 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d1689ae4b1
commit
298bc9a1a5
@ -103,6 +103,14 @@ public:
|
|||||||
/// isEmpty - Returns true if the list is empty.
|
/// isEmpty - Returns true if the list is empty.
|
||||||
bool isEmpty() const { return !X; }
|
bool isEmpty() const { return !X; }
|
||||||
|
|
||||||
|
bool contains(const T& V) const {
|
||||||
|
for (iterator I = begin(), E = end(); I != E; ++I) {
|
||||||
|
if (*I == V)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/// isEqual - Returns true if two lists are equal. Because all lists created
|
/// isEqual - Returns true if two lists are equal. Because all lists created
|
||||||
/// from the same ImmutableListFactory are uniqued, this has O(1) complexity
|
/// from the same ImmutableListFactory are uniqued, this has O(1) complexity
|
||||||
/// because it the contents of the list do not need to be compared. Note
|
/// because it the contents of the list do not need to be compared. Note
|
||||||
|
Loading…
x
Reference in New Issue
Block a user