mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
[kutil] Update map iteration
Add an iterator type to kutil::map, and allow for each loops. Also unify the compare() signature expected by sorting containers, and fixes to adding and sorting in kutil::vector.
This commit is contained in:
@@ -8,11 +8,11 @@ using memory::page_offset;
|
||||
using frame_block_node = kutil::list_node<frame_block>;
|
||||
|
||||
int
|
||||
frame_block::compare(const frame_block *rhs) const
|
||||
frame_block::compare(const frame_block &rhs) const
|
||||
{
|
||||
if (address < rhs->address)
|
||||
if (address < rhs.address)
|
||||
return -1;
|
||||
else if (address > rhs->address)
|
||||
else if (address > rhs.address)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -46,6 +46,6 @@ struct frame_block
|
||||
/// Compare two blocks by address.
|
||||
/// \arg rhs The right-hand comparator
|
||||
/// \returns <0 if this is sorts earlier, >0 if this sorts later, 0 for equal
|
||||
int compare(const frame_block *rhs) const;
|
||||
int compare(const frame_block &rhs) const;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user