S
syncman
I want to do a lot of data manipulation and passing. The buffer I
have always used before STL was a simple char buf[SIZE] .
I can pass its address easily.
void f (char *buf)
I can assign to its middle with a moving pointer.
myStruct *p = (myStruct *) buf; // Cast
*p++ = myValue;
etc
Should I be using a vector<char> or something? I know that it would
provide better type safety (no cast), and would catch overruns. Also,
it would grow as needed, but I don't need that here because I know the
size beforehand. Is it slower? Any other considerations?
Can you say that there is NO reason why anyone should use char[]
instead of vector<char>?
Thanks
have always used before STL was a simple char buf[SIZE] .
I can pass its address easily.
void f (char *buf)
I can assign to its middle with a moving pointer.
myStruct *p = (myStruct *) buf; // Cast
*p++ = myValue;
etc
Should I be using a vector<char> or something? I know that it would
provide better type safety (no cast), and would catch overruns. Also,
it would grow as needed, but I don't need that here because I know the
size beforehand. Is it slower? Any other considerations?
Can you say that there is NO reason why anyone should use char[]
instead of vector<char>?
Thanks