[commands] Delete UB-causing rvalue variants of CommandPtr methods (#4923)

Co-authored-by: Ryan Blue <ryanzblue@gmail.com>
This commit is contained in:
Starlight220
2023-01-12 08:53:04 +02:00
committed by GitHub
parent 34519de60a
commit befd12911c
3 changed files with 34 additions and 15 deletions

View File

@@ -226,7 +226,7 @@ CommandPtr CommandPtr::WithName(std::string_view name) && {
return std::move(wrapper).ToPtr();
}
CommandBase* CommandPtr::get() const {
CommandBase* CommandPtr::get() const& {
AssertValid();
return m_ptr.get();
}
@@ -236,27 +236,27 @@ std::unique_ptr<CommandBase> CommandPtr::Unwrap() && {
return std::move(m_ptr);
}
void CommandPtr::Schedule() const {
void CommandPtr::Schedule() const& {
AssertValid();
CommandScheduler::GetInstance().Schedule(*this);
}
void CommandPtr::Cancel() const {
void CommandPtr::Cancel() const& {
AssertValid();
CommandScheduler::GetInstance().Cancel(*this);
}
bool CommandPtr::IsScheduled() const {
bool CommandPtr::IsScheduled() const& {
AssertValid();
return CommandScheduler::GetInstance().IsScheduled(*this);
}
bool CommandPtr::HasRequirement(Subsystem* requirement) const {
bool CommandPtr::HasRequirement(Subsystem* requirement) const& {
AssertValid();
return m_ptr->HasRequirement(requirement);
}
CommandPtr::operator bool() const {
CommandPtr::operator bool() const& {
return m_ptr.operator bool();
}