Boost logo

Boost :

From: Ross Smith (ross.s_at_[hidden])
Date: 2001-06-22 11:53:07

Greg Colvin wrote:
> If one has only the non-copyable thread object then one
> is tempted to traffic in raw pointers to that object, with
> either the usual risks of dangling pointers or else the
> requirement to keep the thread object around forever.

Why do you see this as a problem specific to threads? It's exactly the
same for iostreams, and for that matter for anything else that's
non-copyable. Making objects non-copyable when the concept they
represent isn't naturally copyable is generally considered a _good_
thing by most C++ programmers.

As for being "tempted to traffic in raw pointers", surely this is
exactly the sort of problem std::auto_ptr and boost::shared_ptr were
created to solve?

Similarly, why have a special create() function instead of an ordinary
constructor, when constructors work perfectly well for every other
non-copyable entity (iostreams etc.)?

I really don't understand what problem you're seeing with this approach.

Ross Smith <ross.s_at_[hidden]> The Internet Group, Auckland, New Zealand
"Unix has always lurked provocatively in the background of the operating
system wars, like the Russian Army."                  -- Neal Stephenson

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