Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-09-29 18:31:19

"Powell, Gary" <powellg_at_[hidden]> writes:

> Powell > I'm a little concerned that it appears you can create bad pointers for
> Powell > this class by inadvertently not using placement new. I'd feel better
> Powell > about it if there was some way to prevent this.
> Abrahams >Generic smart pointer factories are the right way:
> Abrahams > shifted_ptr<U> p = make_shifted_ptr<T>(arg1, arg2, arg3, ref(arg4));
> So you are saying remove the constructor,
> template<class U>
> shifted_ptr( U *);
> and replace it with one that takes a temporary that is created only by make_shifted_ptr?

No, I was suggesting making the constructor private, making
make_shifted_ptr a friend, and have make_shifted_ptr<T>(...) return a

Your approach seems very complicated. Is there a reason to do it
that way?

Dave Abrahams
Boost Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at