I use the extern C function, which returns dynamically allocated const char*
.
I want to use unique_ptr<const char, decltype(std::free)>
to manage it.
But there is no overload std::free(const void*)
, so I get invalid conversion from 'const void*' to 'void*'
and should use const_cast<char*>()
.
Is this just a defect in the standard library or is there something else behind?
source
share