Boost logo

Boost Users :

Subject: Re: [Boost-users] Flyweight: wrapping shared_ptr
From: Joaquin M Lopez Munoz (joaquin_at_[hidden])
Date: 2014-10-08 09:41:41


Joaquin M Lopez Munoz <joaquin <at> tid.es> writes:

> With pointer-like semantics, you have
>
> flyweight<foo> f;
> flyweight<foo*> g;
>
> f->x=0; // OK
> g->x=0; // error
>

This is again a bad example because stored elements are treated as const :-)
Consider instead

std::cout<<f->x;
std::cout<<g->x;

for instance. You get the idea, anyway.

Joaquín M López Muñoz
Telefónica


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net