Boost logo

Boost :

From: Joaquín Mª López Muñoz (joaquin_at_[hidden])
Date: 2006-06-29 12:04:49

me22 ha escrito:

> On 6/28/06, Joaquín Mª López Muñoz <joaquin_at_[hidden]> wrote:
> > During some conversations with a colleague I came up with a very
> > sketchy realization of what could be converted, if there is interest,
> > in a flyweight library. Please see flyweight.hpp at Vault/Patterns:
> >
> > Additionally, comparison of flyweight objects can be made faster than
> > that of the underlying type T, since we it reduces to pointer comparison
> >
> Very nice!

Thank you!

> A few comments:
> - What's y?
> void swap(flyweight& x)
> {
> std::swap(x.h,y.h);
> }

This is my error, please replace with


I've uploaded a corrected version of flyweight.hpp to the Vault.

> - I'm not convinced operator< should be in terms of the pointer. x<y
> being different from (T&)x < (T&)y seems like an easy source of
> errors.

Yes, you've got a point here. My design ideas involve turning flyweight
into a policy-controlled class so that the user can select this kind of
things. I agree with you the default should be T-compatible operator<
and only pointer-based when the user explicitly selects it.

> ~ Scott McMurray
> <OT> Has anyone proposed a good way of doing wrapping for C++0x? That
> problem keeps coming up...

A poor man's approach to wrapping can be taken with Jonathan
Turkanis' BIL library

which has also IMHO an immense potential for all kinds of applications.
Unfortunately, seems like Jonathan is not actively pursuing promoting this
into Boost :(

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