Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2005-04-28 06:16:07


"Bob Bell" <belvis_at_[hidden]> wrote in message
news:loom.20050428T013921-284_at_post.gmane.org...
| Thorsten Ottosen <nesotto <at> cs.auc.dk> writes:

| Seriously, performance may or may not prevent me from using it, depending
| on what it's for and how I'll use it. But performance does not take away
| copy construction or copy assignment.

as I said, I don't think the performance argument is the most important.

| > | > the second reason is that value-based and OO programming are different
and
| > are
| > | > best
| > | > kept seperate; there are different idioms, different parts of the
langauge
| > is
| > | > being used.
| > |
| > | How do you know ptr_containers will be used in OO contexts? Why can't a
user
| > | use such containers to simply keep track of values?
| >
| > he might; but the library is designed for use with OO; just like the "STL"
| > is not really designed for OO. making it better at one thing, makes it
worse
| > at another thing;
| > you can't have both; that's life.
|
| I disagree; STL works just fine in OO contexts. Why do you think it doesn't?

there is nothing in there that has been developed with OO in mind.

do you the qoute from Stepanov about OO?

| > | One of the great strengths of C++ is that it doesn't try to force the
| > | programmer into any one programming paradigm. Your justification for
| > | denying ordinary copy syntax is against this spirit.
| >
| > so you would be against scoped_ptr being not copyable?
|
| The absence of copying in scoped_ptr is not about enforcing or even
| encouraging a programming paradigm. Scoped_ptr denies copying because of
| what scoped _ptr _is_: a non-copyable type.

but we could have made it copyable just like you're trying to say we can make
pointer containers copyable.

at the bottom line, C++ copies too much and sometimes its just a benefit to be
made aware
of that fact

| The same argument cannot be made for ptr_container, for two reasons. First,
| ptr_container is a kind of container,
                         ^^^^^^^^^^^^^^^^
| and containers (as I understand them)
^^^^^^^^^^^^^^

as you remark, pointer containers are "a kind of " containers; so they are not
containers in the usual sense.

| One thing I'm wondering about which I don't think I've seen discussed in
| this thread yet is: suppose you added copy operations to ptr_container.
| Who would be harmed? Before you say "anybody who uses those operations,
| because their performance is degraded," keep in mind that those people are
| also benefitting from those operations. I'm asking about people who are
| harmed without receiving any benefit.

you can't assume that all people are going to see your perceived benefits as
their own benefits.

making a type copyable or not affects how you design your program; I don't
believe it is sound
not to be conscious about cloning of class hierarchies.

in 10 lines of code you can have a copyable ptr_vector if you want, I don't
see why you can't
just do that if you want that?

-Thorsten


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