Peter Dimov wrote:
Once C++14 becomes an official standard, it'd become possible for N3640 to be discussed and, hopefully, accepted;
Same goes for N3641, of course.
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3641.html
I then tried to get the buffer length (in code) but hit a brick wall.
int len = buffer.length; // doesn't exist int len = buffer.length(); // doesn't exist int len = buffer.capacity; // doesn't exist int len = buffer.capacity(); // doesn't exist int len = buffer.size; // doesn't exist int len = buffer.size(); // doesn't exist
Unless I'm not using the object correctly, not being able to retrieve the array's capacity is a major oversight in my opinion.
As a library developer, I want to be passed buffers in this fashion, and know how much data a buffer can hold. Having to guess is not what I was hoping for. Both Java and C# allow you to do this, so why not C++ buffers. -Sid
I thought about it a little, and I guess I could write a wrapper class around shared_ptr<> to provide buffering features. class shared_buffer : public shared_ptr< unsigned char [] > { size_t capacity; ... } Does this type of object not already exist in boost? Am I the only coder who wants this sort of thing? -Sid