Boost logo

Boost :

From: Marc VIALA (mviala_at_[hidden])
Date: 2006-02-22 13:36:22


> < snip >
>
> > By the way, by looking more carefully your interface, I didn't see how
to
> > have a reading access to the raw struct of the guid: attribute
guid;;_data,
> > more precisely, to the raw data pointer: guid::_data.elems. This reading
> > access could be useful for low level access. Does that make sense?
>
> This does make sense. I have added a constructor to initialize from raw
data:
>
> template <ByteInputIterator>
> guid(ByteInputIterator first, ByteInputIterator last);
>
> and a function to get out the raw bytes:
>
> template <ByteOutputIterator>
> void output_bytes(ByteOutputIterator out) {
> std::copy(data_.begin(), data_.end(), out);
> }
>
> Is output_bytes what you are looking for?

I'm just looking for the raw data pointer of the underlying implementation
of boost::array; but your proposal is ok and if I follow you it will be
possible to write:

   boost::guid id ;
    std::vector<char> bytes ;
    id.output_bytes(std::back_inserter(bytes)) ;

But, in that case, it will not be possible to preallocate the output buffer
size because there is no way to get the underlying buffer size (_data). Do
you plan to return the buffer size.

Thanks in advance.

Marc Viala


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