Boost logo

Boost :

From: troy d. straszheim (troy_at_[hidden])
Date: 2006-02-12 16:01:16


On Sat, Feb 11, 2006 at 03:21:55PM -0800, Matthias Troyer wrote:
>
> On Feb 11, 2006, at 2:16 PM, Kim Barrett wrote:
> >
> > The count should be some type that has a fixed (up to byte-order
> > issues)
> > representation, i.e. something like uint64_t.
>
> Or one can leave it up to the archive to decide how to store the
> count. That's why I proposed to introduce a collection_size_type
> object storing the count. Any archive can then decide for itself how
> to serialize it, whether as unsigned int, uint64_t or whatever you like.
>

I'm for this as well... this issue comes up in
basic_binary_i/oprimitive.ipp as well as in collections_save_imp.hpp:

  template<class Archive, class OStream>
  BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
  basic_binary_oprimitive<Archive, OStream>::save(const char * s)
  {
      std::size_t l = std::strlen(s);
      this->This()->save(l);
      save_binary(s, l);
  }

One can fix this by implementing one's own portable binary primitives
(which is what we've done), but that does involve duplicating a lot of
library code in order to change a few lines. The special type for
collection size (if applied consistently) seems cleaner.

-t


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