Boost logo

Boost :

From: Powell, Gary (powellg_at_[hidden])
Date: 2002-04-30 16:11:29

>I don't really think that is such a big issue, unless shared objects
>are hardly shared at all, and maybe not even then. > >The overhead
for the weak pointer need be only one word per object, not >per
pointer, and the smart pointer itself need be only one or two words.

Beman>Well, the issue could be put to rest by providing sizeof()
information for
Beman>a number of compilers. Test code should probably report sizeof()
Beman>routinely, since it is something that people do care about.

Beman>It isn't so much a concern for single smart pointers, but when you
have a
Beman>vector of smart pointers, sizeof() each smart pointer gets

It's alignment that kills me. Most compilers seem to reguard structures
as firewalls and won't compact the data. It in general prevents me from
using "smart" raw types, as I can't afford the padding.

struct Character {
   char c;

struct Integer {
   int i;

struct SmartPointer {
   smart_ptr<T> ptr;

struct foo {
  Character C; // pads with 1 or 3 or 7 bytes.
  Integer I; // pads with 0 or 4 bytes
  SmartPointer P; // may not pad at all. depending on the smart
                        // or it may pad 2 bytes or 6.


Boost list run by bdawes at, gregod at, cpdaniel at, john at