No implicit conversion from ‘T **’ to ‘const T **’
October 21st, 2010
No comments
For a type T, C++ allows an implicit conversion from T* to const T*. This is safe and you most likely used it hundreds of times before (think method calls with const pointer parameters). But if you try it with a double pointer (e.g. implicitly converting T** to const T**) it will fail. gcc for example will tell you something in the lines of:
error: invalid conversion from 'Test**' to 'const Test**'
Have you ever wandered why this is unsafe and wrong and so reported as a compile time error? Read more…