Boost logo

Boost :

From: JOAQUIN LOPEZ MU?Z (joaquin_at_[hidden])
Date: 2004-09-09 12:29:47

----- Mensaje original -----
De: Jonathan Turkanis <technews_at_[hidden]>
Fecha: Jueves, Septiembre 9, 2004 6:44 pm
Asunto: [boost] Re: Empty member optimization

> Second, I don't have time to look into the details of your
> implementation, but I
> wan't to make sure you're aware of the EBO problems Dave Held ran
> into with his
> policy_ptr, based on the loki SmartPtr. Basically, compilers will
> apply EBO once
> or twice for a given class, and that's it. The exception seems to
> be recent
> versions of gcc (I don't remember if its 3.3 or 3.4).

Maybe the implementation can be changed so that compressed_member
can inherit from another compressed_member, so as to make
this syntax feasible:

template <typename T0, typename T1>
    struct A
    : private compressed_member<T0>
      ::and<T1, 1>::type
      ::and<T2, 2>::type

or something similar, resolving to a linear hierarchy
of compressed_member's. AFAICS, EBO applicability limitations
would be solved that way. An sketch of copmresed_member
implementation would be as follows:

struct dummy{};

template <typename T, size_t Index = 0, typename Base=dummy>
struct compresed_member: public Base
  // utility metafunc for adding members
  template <typename Q, size_t AnotherIndex = Index+1>
  struct and
    typedef compressed_member<
      Q, AnotherIndex,
      compressed_member<T, Index, Base>
> type;

  // rest of the implementation

Get the idea?

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo

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