Boost logo

Boost :

From: Gary Powell (Gary.Powell_at_[hidden])
Date: 2001-04-05 13:40:40

> Another point, you are using several C-style casts, why?

MSVC 6.5 complains. Greg had static_cast<> there and the compiler said
"error C2440: 'static_cast' : cannot convert from const struct derived *' to
'void *'
Conversion loses qualifiers."

adding a const_cast<element_type *>() doesn't help. if there was a
remove_const<> it wouldn't work without partial specialization with MSVC. so
I went with a "C" cast.

> > new int(1)
> > new int(2) // throws
> > auto_ptr<int>(new int(1))
> > auto_ptr<int>(new int(2))
> >
> > is a valid sequence. See .
Ok, I now understand the issue with exception safety. So let me just fully
understand the suggested solution. remove auto_ptr_ref?

This worked for gcc, but not MSVC 6.5 (silent compile)
and it made

auto_ptr<T> source() {
 return auto_ptr<T>(new T);
not compile. Which I thought I needed for things like "clone(type const &)"

Would you rather have a auto_ptr_new solution? (With up to say 10 predefined



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