I have the following typedef defined in a certain file:
typedef const uint8_t* BufType;
and in another file, I need to remove the constantness of the pointer. I cannot use the old c-style cast: (uint8_t*)
. How can this be achieved?
Exact Scenario: I have template specialization to deduce data type:
template<Enum E>
struct deduce_datatype_from {};
// Specialization
template<>
struct deduce_datatype_from<E1> {
typedef BufType const uint8_t*;
}
I use this in a function template which is defined as follows:
template <Enum E>
void f(deduce_datatype_from<E>::BufType buf);
// function specialization.
template <>
void f<E1>(deduce_datatype_from<E1>::BufType buf) {
struct write_struct write_req;
write_req.buf = (??)buf;
}
In this case, write_struct
is provided by a lib but no modification happens to buf
, so it should be safe.