I add an issue on reinterpreting a variable and I don't know why..
int ProgressBar(const uint64_t data_sent, const uint64_t data_total, void const *const data) { Dialog *dialog = reinterpret_cast<Dialog*> (data); dialog->setValue((data_sent *100) / data_total); }
the reinterpret_cast seems not allowed and say
reinterpret_cast
reinterpret_cast from 'const void *) to Dialog * casts away qualifiers
Any idea
As Nick Strupat stated in comment,
reinterpret_cast can't cast away cv-qualifiers
So you can use reinterpret_cast and const_cast together.
const_cast
Dialog *dialog = const_cast<Dialog*>(reinterpret_cast<const Dialog *>(data));
2.1m questions
2.1m answers
60 comments
57.0k users