Friday, 9 August 2013

void* vs vector in c++

void* vs vector in c++

When am dealing with the unsigned data types, i have a requirement to have
a generic container that would accommodate uint8,uint16,uint32 and uint64
types. Having a void* and casting the above data types helped me, still
replacing them instead with vector made the code look more clean.
void* test = (uint32_t) 100;
vs
pushing the same thing bytewise onto a vector test;
which would be a better and cleaner solution.
PS: i cant use boost, due to restrictions in module.

No comments:

Post a Comment