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:
@@ -39,6 +39,21 @@ const double Timer::kRolloverTime = (1ll << 32) / 1e6;
|
||||
|
||||
Timer::Timer() { Reset(); }
|
||||
|
||||
Timer::Timer(const Timer& rhs)
|
||||
: m_startTime(rhs.m_startTime),
|
||||
m_accumulatedTime(rhs.m_accumulatedTime),
|
||||
m_running(rhs.m_running) {}
|
||||
|
||||
Timer& Timer::operator=(const Timer& rhs) {
|
||||
std::scoped_lock lock(m_mutex, rhs.m_mutex);
|
||||
|
||||
m_startTime = rhs.m_startTime;
|
||||
m_accumulatedTime = rhs.m_accumulatedTime;
|
||||
m_running = rhs.m_running;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
Timer::Timer(Timer&& rhs)
|
||||
: m_startTime(std::move(rhs.m_startTime)),
|
||||
m_accumulatedTime(std::move(rhs.m_accumulatedTime)),
|
||||
|
||||
Reference in New Issue
Block a user