mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[commands] C++ CommandPtr: Prevent null initialization (#5991)
This commit is contained in:
@@ -27,8 +27,7 @@ namespace frc2 {
|
||||
*/
|
||||
class CommandPtr final {
|
||||
public:
|
||||
explicit CommandPtr(std::unique_ptr<Command>&& command)
|
||||
: m_ptr(std::move(command)) {}
|
||||
explicit CommandPtr(std::unique_ptr<Command>&& command);
|
||||
|
||||
template <std::derived_from<Command> T>
|
||||
// NOLINTNEXTLINE(bugprone-forwarding-reference-overload)
|
||||
@@ -39,6 +38,8 @@ class CommandPtr final {
|
||||
CommandPtr(CommandPtr&&) = default;
|
||||
CommandPtr& operator=(CommandPtr&&) = default;
|
||||
|
||||
explicit CommandPtr(std::nullptr_t) = delete;
|
||||
|
||||
/**
|
||||
* Decorates this command to run repeatedly, restarting it when it ends, until
|
||||
* this command is interrupted. The decorated command can still be canceled.
|
||||
|
||||
Reference in New Issue
Block a user