Boost logo

Boost Users :

Subject: Re: [Boost-users] [Boost-announce] [Review] UUID library (mini-)review starts today, November 23rd
From: Andy Tompkins (atompkins_at_[hidden])
Date: 2008-12-10 13:29:34


On Tue, 9 Dec 2008 18:15:44 -0500, "Daryle Walker"
<darylew_at_[hidden]> said:
> On Dec 9, 2008, at 12:17 PM, Andy Tompkins wrote:
>
> > On Tue, 9 Dec 2008 03:34:01 -0500, "Daryle Walker"
> > <darylew_at_[hidden]> said:
> >>
> [SNIP]
> >> Is default construction useful besides when initialization can't be
> >> done in one step? Instead of an "is_null" member function, maybe
> >> (pseudo- )Boolean conversion (and "operator not") can be used.
> >
> > The default constructor is unintuitive. I will likely remove it. I
> > will add a 'boolean' conversion and possibility operator!.
> >
> >> I don't think the multitude of string conversion techniques are
> >> needed. Keep the constructor with "char const *" for pseudo-
> >> literals. Everything else, in either direction, could use
> >> "lexical_cast".
> >
> > I agree, lexical_cast is good. I will remove the to_..._string
> > functions. The constructor that takes a string will likely move to a
> > generator.
> [SNIP]
>
> So, there won't be any constructors besides the constructor template
> that takes an input iterator for sixteen octet reads (and an implicit
> copy constructor)? You could make UUID a POD type if you could move
> that constructor too. (It could probably be moved to a creation
> function, done as a static member function for UUID. The Nil-UUID can
> be implemented this way too.)

Yes, all the user defined constructors could be moved into generators /
static functions / free functions. The uuid class could be a POD. What
are the benefits of making it a POD? I don't yet understand the
advantages.

> >> Should the serialization be done in a separate header? BTW, how is
> >> a custom primitive type handled? Is it just a byte-level save/load
> >> of memory? (What if the type isn't POD, like this one?)
> >
> > Yes, it is a byte-level save/load. My reason was so that exactly
> > 128 bytes are saved/loaded.
> [TRUNCATE]
>
> You mean 128 bits, or 16 octets. An alternative I used, for a MD5 bit-
> queue, was to group the bits into sextets (6-packs), map that to a base-
> 64 string, and serialize that string. For 128 bits, you get 21
> sextets and 2 remaining bits, for a string of 22 characters.

Yes, thanks, I mean 128 bits or 16 octets. One will be able to use
lexical_cast to convert a uuid to/from a string. I can also see the
usefulness to be able to convert to/from a base-64 string, a single
integer value, or other types of binary to text encoding (like ascii85),
but I'm not sure these are in the scope of uuid.

> --
> Daryle Walker Mac, Internet, and Video Game Junkie darylew AT
> hotmail DOT com

Regards, Andy Tompkins


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net