[commands] Report error on C++ CommandPtr use-after-move (#4575)

This commit is contained in:
Starlight220
2022-11-15 00:20:52 +02:00
committed by GitHub
parent d07267fed1
commit 49047c85b9
3 changed files with 78 additions and 0 deletions

View File

@@ -259,6 +259,11 @@ class CommandPtr final {
*/
bool HasRequirement(Subsystem* requirement) const;
/**
* Check if this CommandPtr object is valid and wasn't moved-from.
*/
explicit operator bool() const;
/**
* Convert a vector of CommandPtr objects to their underlying unique_ptrs.
*/
@@ -267,6 +272,7 @@ class CommandPtr final {
private:
std::unique_ptr<Command> m_ptr;
void AssertValid() const;
};
} // namespace frc2