But what I meant was that the OP's problematic statement was
boost::for_each(vec
| transformed(bind(&trasform, _1))
| indirected,
bind(&foo::bar, _1));
which is a single expression, so it's reasonable to anticipate that 'temporary' shared_ptrs created in the course of evaluating
this expression should persist until the end of the expression. Ok, I know there's lots of holes in that if you analyse it carefully,
not least that the shared_ptrs in question are not ever explicit, so the rules aren't required to apply, but it might be reasonable to
expect that they would persist.
I'm really not nailing my colours to the mast here, just speculating, so be gentle!