Boost logo

Boost :

From: Joaquín Mª López Muñoz (joaquin_at_[hidden])
Date: 2008-01-25 02:40:10


Hello David, thanks for your review!

David Sankel ha escrito:

[...]

> My preference on the equality mechanism would be to make it a
> configuration option via a template parameter during construction with
> the default being (fw1.get()==fw1.get()) instead of
> (&(fw1.get())==&(fw1.get()). The benefit would be that those who would
> understand when this would fail could enable the quicker behavior
> while those who don't understand could remain in blissful ignorance.

Is it really necessary to provide a template parameter to control that?
After all, if flyweight<...> provided (fw1.get()==fw1.get()) semantics,
it's trivial to override this on a per case basis:

  typedef flyweight<whatever,...> fw_t;

  inline bool operator==(const fw_t& x,const fw_t& y)
  {
    return &x.get()==&y.get();
  }

Not sure if this deserves a config parameter of its own...

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


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