Boost logo

Boost :

Subject: Re: [boost] Interest in a simple buffer abstraction?
From: Boris Kolpackov (boris_at_[hidden])
Date: 2011-01-27 14:33:45


Hi Robert,

"Stewart, Robert" <Robert.Stewart_at_[hidden]> writes:

> The idea has merit, but I wonder if an adaptor approach would be better.
> That is, permit construction of your buffer type from various other
> storage types, like std::vector, boost::array, char [], etc., and
> simply adapt them to a common interface for use by other code.

This way I would have to write:

class packet
{
  packet (void* data, size_t size)
    : data_ (data_storage_, data, size)
  {
  }

  std::vector data_storage_;
  boost::buffer data_;
};

Which i find quite hairy.

Boris

-- 
Boris Kolpackov, Code Synthesis        http://codesynthesis.com/~boris/blog
Compiler-based ORM system for C++      http://codesynthesis.com/products/odb
Open-source XML data binding for C++   http://codesynthesis.com/products/xsd
XML data binding for embedded systems  http://codesynthesis.com/products/xsde

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk