mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Fix implicitly deleted move constructors (#1954)
These were incorrect and exhibited as warnings on more recent versions of clang (notably on Mac). - Use pointers instead of references internally in GenericHID and *Drive - Leave PIDBase, PIDController, and Resource non-moveable - Remove the atomic from m_disabled in NidecBrushless - Make Timer and Trigger copyable as well as moveable - Implement custom move constructor/assignment for SendableChooserBase Also comment out some unused variables that caused clang warnings.
This commit is contained in:
@@ -16,3 +16,22 @@ std::atomic_int SendableChooserBase::s_instances{0};
|
||||
SendableChooserBase::SendableChooserBase() : m_instance{s_instances++} {
|
||||
SendableRegistry::GetInstance().Add(this, "SendableChooser", m_instance);
|
||||
}
|
||||
|
||||
SendableChooserBase::SendableChooserBase(SendableChooserBase&& oth)
|
||||
: SendableHelper(std::move(oth)),
|
||||
m_defaultChoice(std::move(oth.m_defaultChoice)),
|
||||
m_selected(std::move(oth.m_selected)),
|
||||
m_haveSelected(std::move(oth.m_haveSelected)),
|
||||
m_activeEntries(std::move(oth.m_activeEntries)),
|
||||
m_instance(std::move(oth.m_instance)) {}
|
||||
|
||||
SendableChooserBase& SendableChooserBase::operator=(SendableChooserBase&& oth) {
|
||||
SendableHelper::operator=(oth);
|
||||
std::scoped_lock lock(m_mutex, oth.m_mutex);
|
||||
m_defaultChoice = std::move(oth.m_defaultChoice);
|
||||
m_selected = std::move(oth.m_selected);
|
||||
m_haveSelected = std::move(oth.m_haveSelected);
|
||||
m_activeEntries = std::move(oth.m_activeEntries);
|
||||
m_instance = std::move(oth.m_instance);
|
||||
return *this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user