diff --git a/code/espurna/sensor.cpp b/code/espurna/sensor.cpp index 2816e8e3..7162cf5e 100644 --- a/code/espurna/sensor.cpp +++ b/code/espurna/sensor.cpp @@ -227,14 +227,18 @@ struct sensor_magnitude_t { } sensor_magnitude_t() = delete; - sensor_magnitude_t& operator=(const sensor_magnitude_t&) = default; - sensor_magnitude_t(const sensor_magnitude_t&) = default; - sensor_magnitude_t(sensor_magnitude_t&& other) { + + sensor_magnitude_t(const sensor_magnitude_t&) = delete; + sensor_magnitude_t(sensor_magnitude_t&& other) noexcept { *this = other; other.filter = nullptr; } + ~sensor_magnitude_t() { + delete filter; + } + sensor_magnitude_t(unsigned char slot, unsigned char index_local, unsigned char type, sensor::Unit units, BaseSensor* sensor); BaseSensor * sensor { nullptr }; // Sensor object @@ -259,6 +263,16 @@ struct sensor_magnitude_t { }; +static_assert( + std::is_nothrow_move_constructible::value, + "std::vector should be able to work with resize()" +); + +static_assert( + !std::is_copy_constructible::value, + "std::vector should only use move ctor" +); + unsigned char sensor_magnitude_t::_counts[MAGNITUDE_MAX] = {0}; namespace sensor {