diff --git a/Source/cmLinkedTree.h b/Source/cmLinkedTree.h index 3bcb940504..721a24606c 100644 --- a/Source/cmLinkedTree.h +++ b/Source/cmLinkedTree.h @@ -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 diff --git a/Source/cmState.cxx b/Source/cmState.cxx index f425861144..66f19c378c 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -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); +} diff --git a/Source/cmState.h b/Source/cmState.h index 07aa2a55b9..3132d1b8e7 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -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; };