$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] Interest in a simple buffer abstraction?
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2011-01-27 07:05:07
On 27/01/2011 11:53, Boris Kolpackov wrote:
> Hi,
>
> While working on the Boost profile for ODB C++ ORM[1], I was looking
> for a Boost type to map the database BLOB type to. I hoped to find
> something that would encapsulate the memory management and provide
> basic operations like copy (memcpy), append, set all bytes in a buffer
> to a specific value (memset), etc. Something that I could use like
> this:
>
> class packet
> {
>    address to_;
>    boost::buffer payload_;
>
> public:
>    packet (const address&  to, const void* data, std::size_t size)
>      to_ (to), data_ (data, size)
>    {
>    }
>
>    const boost::buffer&  payload () const
>    {
>      return payload_;
>    }
> };
>
> class socket
> {
> public:
>    void send (const packet&  p)
>    {
>      ...
>      s_.send (p.payload ().data (), p.payload ().size ())
>    }
> };
How is that any different from std::vector<char>?