
On Aug 10, 2013, at 8:25 AM, Edward Diener
On 8/9/2013 9:45 PM, Geoff Shannon wrote:
Particularly, I'm interested in ideas for an appropriate replacement for using char *'s as the data buffers for reading and writing.
std::vector<TYPE> is the C++ way of specifying arrays.
If you do that, don't use resize() and size(). Use reserve() and capacity(), and don't forget to push_back() one element to make &v[0] valid. Having said all that, it really should be wrapped in a buffer class to prevent mistakes. Perhaps that has the makings of a useful Boost addition in its own right. There's also std::array and boost::array. You could even combine the two into one class to get SBO, though I think that's not likely to be useful if the caller allocates the memory. (It would be useful if the API allocates space.) ___ Rob (Sent from my portable computation engine)