Boost logo

Boost :

From: Kevlin Henney (kevlin_at_[hidden])
Date: 2000-11-08 16:21:21


In message <B62F2077.3B1%darylew_at_[hidden]>, Daryle Walker
<darylew_at_[hidden]> writes
>Why bother? The value must be constant, and the user generally doesn't need
>to know it. If the size is needed in a program, the user can use
>"sizeof(any)" in his/her code. However, if the user needs the size of the
>contained object, maybe you could add a size() method.
>
>I may be objecting too harshly. If you want to put it in an implementation
>section of the docs, go ahead. (Make sure to warn the reader that these
>details can change anytime.)

Yes, any has a constant footprint, although its working set varies, but
the fact that it's a constant size based on a single pointer rather than
two pointers or a pointer and some kind of tag may be significant to
some users.

IIRC, the debates about how shared_ptr should be implemented were very
much around this distinction -- a pointer to a count plus a pointer to
the object vs a pointer to a body holding the count and a pointer to the
object.

So yes, it is an implementation detail, but it may be worth documenting
in an implementation section of the docs, with the understanding that
such details are subject change.

Kevlin
____________________________________________________________

  Kevlin Henney phone: +44 117 942 2990
  Curbralan Limited mobile: +44 7801 073 508
  mailto:kevlin_at_[hidden] fax: +44 870 052 2289
  http://www.curbralan.com
____________________________________________________________


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