Boost logo

Boost :

From: David B. Held (dheld_at_[hidden])
Date: 2002-07-30 18:30:22


"Philippe A. Bouchard" <philippeb_at_[hidden]> wrote in message
news:ai74ji$1g8$1_at_main.gmane.org...
> [...]
> Won't work. I don't see how shared_ptr<> is better in this situation.

Well, shared_ptr<> "just does the right thing", like it often does. ;)
That's
how it's better.

> My 'hacks' will prevent the user from implicitly doing an error: you'll
> have to explicitly prove you know what you are doing.

Well, when I delete a polymorphic object through a base pointer, I know
what I'm doing; but do you?

> 'Hack' is also relative. I could say the same thing about & foo
> expressions when there are two overloaded version of the function.
> You now need some compiler hack: (void (*)(int)) & foo. What about:
> istream & getline(istream &, basic_string &) ?

Resolving ambiguities is entirely different from making liberal use of
reinterpret_cast<>, whose results are not even always defined, or
portable across implementations. I don't think most people would
hesitate to call a class with a reinterpret_cast in almost every member
function "a hack", especially when other implementations exist that
provide greater functionality with more correctness, safety, and
portability.

Dave


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