reinterpret_cast casts away qualifiers

后端 未结 2 795
囚心锁ツ
囚心锁ツ 2021-02-02 07:01

I add an issue on reinterpreting a variable and I don\'t know why..

int ProgressBar(const uint64_t data_sent, const uint64         


        
2条回答
  •  死守一世寂寞
    2021-02-02 07:33

    As Nick Strupat stated in comment,

    reinterpret_cast can't cast away cv-qualifiers

    So you can use reinterpret_cast and const_cast together.

    Dialog *dialog = const_cast(reinterpret_cast(data));
    

提交回复
热议问题