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:
Ingo Weinhold 2013-08-06 00:39:13 +02:00
parent 8a2643daee
commit 040a81419d
3 changed files with 11 additions and 9 deletions

View File

@ -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;

View File

@ -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)

View File

@ -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