mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-09-13 06:29:47 -04:00
Add relational operators
This commit is contained in:
parent
ad60063eff
commit
1409d1443f
@ -205,6 +205,26 @@ public:
|
||||
return const_iterator(&data[_size]);
|
||||
}
|
||||
|
||||
// Relational operators
|
||||
|
||||
bool operator==(const vector& rhs) const {
|
||||
if(size() != rhs.size()){
|
||||
return false;
|
||||
}
|
||||
|
||||
for(size_t i = 0; i < size(); ++i){
|
||||
if((*this)[i] != rhs[i]){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool operator!=(const vector& rhs) const {
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
private:
|
||||
void ensure_capacity(size_t new_capacity){
|
||||
if(_capacity == 0){
|
||||
|
Loading…
x
Reference in New Issue
Block a user