Add moves to the ModKey::Parameters

This commit is contained in:
Paul Ferrand 2020-11-17 18:35:46 +01:00 committed by Jean Pierre Cimalando
parent 09333b3cec
commit 31103d11a2
2 changed files with 20 additions and 2 deletions

View file

@ -38,6 +38,24 @@ ModKey::Parameters& ModKey::Parameters::operator=(const Parameters& other) noexc
return *this;
}
ModKey::Parameters::Parameters(Parameters&& other) noexcept
{
std::memcpy(
static_cast<RawParameters*>(this),
static_cast<const RawParameters*>(&other),
sizeof(RawParameters));
}
ModKey::Parameters& ModKey::Parameters::operator=(Parameters&& other) noexcept
{
if (this != &other)
std::memcpy(
static_cast<RawParameters*>(this),
static_cast<const RawParameters*>(&other),
sizeof(RawParameters));
return *this;
}
ModKey ModKey::createCC(uint16_t cc, uint8_t curve, uint8_t smooth, float step)
{
ModKey::Parameters p;

View file

@ -59,8 +59,8 @@ public:
Parameters(const Parameters& other) noexcept;
Parameters& operator=(const Parameters& other) noexcept;
Parameters(Parameters&&) = delete;
Parameters &operator=(Parameters&&) = delete;
Parameters(Parameters&&) noexcept;
Parameters &operator=(Parameters&&) noexcept;
bool operator==(const Parameters& other) const noexcept
{