cmState: Make it possible to order cmState::Snapshot.

This commit is contained in:
Stephen Kelly 2015-08-02 10:07:30 +02:00
parent 04168cbb59
commit 55e3927634
3 changed files with 20 additions and 0 deletions

View File

@ -128,6 +128,13 @@ public:
}
return this->Position <= this->Tree->Data.size();
}
bool StrictWeakOrdered(iterator other) const
{
assert(this->Tree);
assert(this->Tree == other.Tree);
return this->Position < other.Position;
}
};
iterator Root() const

View File

@ -1411,3 +1411,9 @@ void cmState::Directory::ClearCompileOptions()
this->DirectoryState->CompileOptionsBacktraces,
this->Snapshot_.Position->CompileOptionsPosition);
}
bool cmState::Snapshot::StrictWeakOrder::operator()(
const cmState::Snapshot& lhs, const cmState::Snapshot& rhs) const
{
return lhs.Position.StrictWeakOrdered(rhs.Position);
}

View File

@ -74,9 +74,16 @@ public:
Directory GetDirectory() const;
struct StrictWeakOrder
{
bool operator()(const cmState::Snapshot& lhs,
const cmState::Snapshot& rhs) const;
};
private:
friend class cmState;
friend class Directory;
friend struct StrictWeakOrder;
cmState* State;
cmState::PositionType Position;
};