Add node_ref::operator <
Moved from VirtualDirectoryManager. Defining the operator static doesn't work with gcc 4 and it's useful to have globally available anyway.
This commit is contained in:
parent
8a2643daee
commit
040a81419d
@ -22,6 +22,7 @@ struct node_ref {
|
||||
|
||||
bool operator==(const node_ref& ref) const;
|
||||
bool operator!=(const node_ref& ref) const;
|
||||
bool operator<(const node_ref& ref) const;
|
||||
node_ref& operator=(const node_ref& ref);
|
||||
|
||||
dev_t device;
|
||||
|
@ -68,6 +68,16 @@ node_ref::operator!=(const node_ref &ref) const
|
||||
return !(*this == ref);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
node_ref::operator<(const node_ref& other) const
|
||||
{
|
||||
if (this->device != other.device)
|
||||
return this->device < other.device;
|
||||
return this->node < other.node;
|
||||
}
|
||||
|
||||
|
||||
// =
|
||||
node_ref&
|
||||
node_ref::operator=(const node_ref &ref)
|
||||
|
@ -35,15 +35,6 @@ static const char* const kTemporaryDefinitionFileBaseDirectoryPath
|
||||
= "/tmp/tracker/virtual-directories";
|
||||
|
||||
|
||||
static bool
|
||||
operator<(const node_ref& a, const node_ref& b)
|
||||
{
|
||||
if (a.device != b.device)
|
||||
return a.device < b.device;
|
||||
return a.node < b.node;
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark - Info
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user