|
Boost : |
Subject: Re: [boost] [Interprocess] Named pipe interface proposal
From: Rob Stewart (robertstewart_at_[hidden])
Date: 2013-08-10 20:59:46
On Aug 10, 2013, at 8:25 AM, Edward Diener <eldiener_at_[hidden]> wrote:
> 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)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk