It seems that there are still cases where copying gadget::DeviceInterface<T> instances can fail. In particular, the following usage can lead to crashes:
mAnalogIfVec.reserve(num_analogs);
for ( unsigned int i = 0; i < num_analogs; ++i )
{
const std::string analog_name(getAnalaogName(i));
gadget::AnalogInterface analog_if;
analog_if.init(analog_name);
mAnalogIfVec.push_back(analog_if);
}
However, the following works fine:
mAnalogIfVec.resize(num_analogs);
for ( unsigned int i = 0; i < num_analogs; ++i )
{
const std::string analog_name(getAnalaogName(i));
mAnalogIfVec[i].init(analog_name);
}
Note the difference between using std::vector<gadget::AnalogInterface>::reserve() versus std::vector<gadget::AnalogInterface>::resize().