Boost logo

Boost :

From: Dave Abrahams (abrahams_at_[hidden])
Date: 2000-03-18 10:22:23


on 3/18/00 1:21 AM, Greg Colvin at gcolvin_at_[hidden] wrote:

> Yes, I meant template code, and the evil thing might be as simple
> as trying to pass shared_array<char> to strncpy(). Yes, I know,
> the C string functions are evil. They are also implemented as
> very fast intrinisics on many compilers.

So... you've got template code which only accepts raw and smart pointers to
char*, but no other type? Seems like an edge case to me.

> Even without templates not having the conversion is an obstacle to
> converting code that uses raw pointers to use shared_ptr. It is not
> at all unusual to pass objects around by address, with a convention
> that functions that take a pointer to an object do not ever delete
> the object.

About the only justifiable role I have found for implicit conversions like
this one involve interfacing to legacy systems, so I understnd this desire.
However, it seems like you'd want to isolate the use of such machinery, and
probably have both kinds of smart pointer (with and without it) in the same
project. Maybe we should just have an optional template parameter which
turns on conversion to T*.

-Dave


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