Boost logo

Boost :

From: Bruno Martínez Aguerre (br1_at_[hidden])
Date: 2004-10-06 20:57:27


> | Second, it's not clear to me what smart
> |containers add to this particular problem, given that smart pointers
> |are available.
>
> I have used container< shared_ptr<T> > extensively and I still felt that
> it didn't feel good. All the syntax is different with indirection all
> over the
> place
> and something as simple as vec.push_back( new Foo ) expanding into
> vec.push_back( shared_ptr<Foo>( new Foo ) )
> and different cast styles etc.
>
> I usually can take such syntax, but I worked and do work with people
> that are
> just plain confused by all that syntactic
> overhead. For them, I think the smart pinter interface is part of the
> problem.

Why can't you solve this inconvenience with small free functions? ie:

vector<shared_ptr<int> > v;
push_back_new(v, new int(8));
for_each(indirect_begin(v), indirect_end(v), cout << _1);

Bruno Martinez


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