R
red floyd
I got an error by using std::fill to set an array of pointers to 0.
e.g.:
class XXX;
XXX* v[30];
std::fill(v, v+30, 0); // <-- ERROR -- cant' match template type
I have to either explicitly instantiate std::fill<> or cast 0 to XXX*.
I've been using th latter:
std::fill(v, v+30, static_cast<XXX*>(0));
I understand the issue, that template instantiation processing is
interpreting the 0 as an integer rather than a pointer value (and thus
I have to help it along with the cast). Is there any other workaround
for this? Will the proposed "nullptr" be handled properly in this sort
of case?
e.g.:
class XXX;
XXX* v[30];
std::fill(v, v+30, 0); // <-- ERROR -- cant' match template type
I have to either explicitly instantiate std::fill<> or cast 0 to XXX*.
I've been using th latter:
std::fill(v, v+30, static_cast<XXX*>(0));
I understand the issue, that template instantiation processing is
interpreting the 0 as an integer rather than a pointer value (and thus
I have to help it along with the cast). Is there any other workaround
for this? Will the proposed "nullptr" be handled properly in this sort
of case?