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<Dialog*>(reinterpret_cast<const Dialog *>(data));
Related Contents:
- When to use reinterpret_cast?
- Why doesn’t this reinterpret_cast compile?
- Proper way of casting pointer types
- reinterpret_cast cast cost
- When should static_cast, dynamic_cast, const_cast, and reinterpret_cast be used?
- Regular cast vs. static_cast vs. dynamic_cast [duplicate]
- Why use static_cast(x) instead of (int)x?
- How to cast int to enum in C++?
- Should I use static_cast or reinterpret_cast when casting a void* to whatever
- Implicit type conversion rules in C++ operators
- How to cast/convert pointer to reference in C++
- dynamic_cast and static_cast in C++
- C++ convert from 1 char to string?
- Can I assume (bool)true == (int)1 for any C++ compiler?
- Passing shared_ptr as shared_ptr
- Efficient unsigned-to-signed cast avoiding implementation-defined behavior
- Converting a pointer into an integer
- Is it safe to delete a void pointer?
- Is const_cast safe?
- Why do C and C++ allow the expression (int) + 4*5?
- Can a cast operator be explicit?
- C++ style cast from unsigned char * to const char *
- Generic way to cast int to enum in C++
- When is an integerpointer cast actually correct?
- error: cast from ‘void*’ to ‘int’ loses precision
- How do I avoid implicit conversions on non-constructing functions?
- Performance hit from C++ style casts?
- casting non const to const in c++
- How to cast the size_t to double or int C++
- C++ cannot convert from base A to derived type B via virtual base A
- What is the difference between static_cast and reinterpret_cast? [duplicate]
- What does casting to `void` really do? [duplicate]
- If I use C-Style casts in my C++ project, is it worth refactoring to C++ casts?
- Purpose of a “.f” appended to a number?
- Why do round() and ceil() not return an integer?
- Difference in behavior while using dynamic_cast with reference and pointers
- Should I worry about the alignment during pointer casting?
- Reinterpret_cast vs. C-style cast
- Multi-character constant warnings
- Dynamic casting for unique_ptr
- Why can’t I static_cast between char * and unsigned char *?
- Why is there a performance warning on casting pointer to bool?
- Function pointers casting in C++
- Parsing a binary file. What is a modern way?
- “warning: use of old-style cast” in g++ [duplicate]
- convert unsigned char* to std::string
- Casting int to bool in C/C++
- What does (void *)1 mean?
- How to cast away the volatile-ness?
- C++ int float casting