Topic: auto_ptr efficiency (was: Construct final in exception


Author: "john (j.d.) hickin" <hickin@nortel.ca>
Date: 1996/11/14
Raw View
>One way of dealing with this is by using template specialization
>to only do this optimization if the size of the object is one
>for which there is a type of that size that requires at least
>two-byte alignment; on most platforms, any object with a non-even
>size will fit this criterion.

I think that this is a fine idea.

Note also, that the trick of using the low order bits for encoding extra info
in the pointer's representation may even be used for some of the 'special'
allocator cases provided that we are willing to assume that the high order bits

are zero.  In many instances, this may be possible to ensure, and if the
auto_ptr specialization is bundled with the allocator we may have our cake and
eat it too.

--
John Hickin      Nortel Technology, Montreal, Quebec
(514) 765-7924   hickin@nortel.ca
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]