www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: Serious problem with opCmp

reply kov_serg <kov_serg freemail.ru> writes:
Bill Baxter Wrote:
...
 But I do think the examples of using opCmp should be changed to be more 
 like "return lv<rv?-1: rv<lv?+1: 0;" as you said (where lv is member of 
 'this' in the D version).

Yes. I've just pointed out the problem exist and I want to eliminate this mistake and prevent other people to copy it into their code. It requires to review and rewrite documentation and codes have been writen by people till now.
Mar 02 2008
parent reply kov_serg <kov_serg freemail.ru> writes:
Content-Type: text/plain

Bill Baxter Wrote:

 If you want to help you can start by editing the comment page for 
 operator overloading:
 http://www.prowiki.org/wiki4d/wiki.cgi?DocComments/OperatorOverloading
 
 (which I added just a week or two ago, trying to be helpful because I 
 couldn't find any examples of how to write an opCmp... but apparently 
 they live in the "array" section of the documentation for some reason.)

I'll try to write something soon. But I am only start to lean D language. Here is an test code (opCmp.and.Sort.problem.zip) with output for cmp and sort for v1 and v2. And it shows the strange behaviour not only for opCmp but for buildin sort for dinamic array.
Mar 03 2008
parent kov_serg <kov_serg freemail.ru> writes:
Content-Type: text/plain

Bill Baxter Wrote:

http://www.prowiki.org/wiki4d/wiki.cgi?DocComments/OperatorOverloading
 I went ahead and did it.  I don't think it requires a novel or anything. 
   Just a few sentences.

Sorry, I am asking such silly question. But how to insert image in proWiki?
Mar 03 2008