Python Productivity over C++

Wim Lavrijsen wlav at hpatl26.cern.ch
Mon Jun 19 05:51:02 EDT 2000


"Rainer Deyke" <root at rainerdeyke.com> writes:
>Wim Lavrijsen <wlav at hpatl26.cern.ch> wrote in message

>> Nonsense. You can specialize std::set with your own version of comparison
>> class instead of the standard less and you can make sure that your version
>> of it does not require said operators.

>True, but writing your own comparison class is at least as much work as
>implementing operator <.

Whether it is a lot of work depends on how many classes will use your new
version of less<>.

>Besides, IIRC you still need operator ==.

YDNRC. Perhaps you care to read clause 3 in paragraph 20.1 of the C++
standard to refresh your memory?

>> >Misleading because for many classes the compiler generated functions cause
>> >incorrect behavior.
>>
>> As I have explained in another post, 'many' is only true for buggy code
>> that is not exception safe.

>For some values of 'many'.  Smart pointers can help, but the smart pointer
>classes themselves almost always need explicit copy contructors and operator
>=,

Agreed. Then again, no-one should write his own smart pointer. (I admit,
I sinned, I wrote a smart pointer: it was copied, modified and proliferated
by several people. I learned, won't do it again.)

>and if you deal with a variety of objects and resources you'll need a
>variety of smart pointers.

Agreed.

>For example, COM objects would need their own smart pointer class. 

COM is a particular bad example as MS delivers several different smart
pointers for this technology and most textbooks on COM come with yet
another version.

Best regards,
        Wim Lavrijsen

(Who nows damn well that he just delivered another argument against being
able to write your own reference semantics.)



More information about the Python-list mailing list