I’m designing a Buffer class whose purpose is to represent a chunk of memory.
My underlying buffer is a char* (well, a boost::shared_array<char> actually, but it doesn’t really matter).
I’m stuck at deciding what prototype to choose for my constructor:
Should I go with:
Buffer(const void* buf, size_t buflen);
Or with:
Buffer(const char* buf, size_t buflen);
Or something else ?
What is usually done, and why ?
API interface is more clear for user, if buffer has void* type, and string has char* type. Compare memcpy and strcpy function definitions.