Boost logo

Boost :

From: John Maddock (john_at_[hidden])
Date: 2004-09-09 05:23:43


> I have written a small utility class to provide "empty member
> optimization" for arbitrary types. The implementation makes use of the
> empty base class optimization (EBCO) but avoids injection of the class.
> A uniform and contained interface is exposed wether the optimization
> applies or not:

> I believe this could be used as the basis for a compressed_tuple.
>
> Here's a sample use:
>
> template <typename T0, typename T1>
> struct A
> : private compressed_member<T0>
> , private compressed_member<T1, 1>
> {
> typedef compressed_member<T0> member0;
> typedef compressed_member<T1, 1> member1;
>
> T0 const & first() { return base0::get(); }
> T1 const & second() { return base1::get(); }
> };

How does this differ from boost::compressed_pair ?

John.


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