mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[commands] Report error on C++ CommandPtr use-after-move (#4575)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user