John, Bishnupriya,
a straight-forward implementation (e.g. based on unique ids with a
"magic id" 0 for empty handles) would lead to equivalent empty handles.
See below.
On 24/03/10 12:37, john.aynsley@doulos.com wrote:
> Bishnupriya,
>
> You wrote
>
> I agree that using an unique integer id for each process object will allow
> an invalidating implementation to implement operator < correctly, as laid
> down below in Philip's 3 bullet points. Note that the corner case of two
> invalid handles where the handles never did point to any process objects
> need also be covered, and such handles should not be equivalent, and
> should not be equal (i.e. they should be unequal)
> sc_process_handle a,b;
> sc_assert(!(a<b) && !(b<a));
> sc_assert(a!=b);
This original code is what I would have expected: empty handles are
unequal (as per current standard), but equivalent (neither is "less
than" the other).
> I think you meant:
>
> sc_process_handle a,b;
> sc_assert( (a<b) || (b<a) );
In this case, you could fill up a map with empty handles indefinitely
(and never find empty handles in such a container):
std::map< sc_process_handle, int > m;
sc_process_handle no_proc;
for( int i=0; i<10; ++i )
// always adds a new entry to the map :(
m[ no_proc ]++;
So I think, the original code example of Bishnupriya has been correct,
and the explaining text contained a typo. Am I right?
Greetings from Oldenburg,
Philipp
[snip]
-- Philipp A. Hartmann Hardware/Software Design Methodology Group OFFIS R&D Division Transportation | FuE-Bereich Verkehr Escherweg 2 · 26121 Oldenburg · Germany Phone/Fax: +49-441-9722-420/282 · PGP: 0x9161A5C0 · http://www.offis.de/ -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Wed Mar 24 05:27:48 2010
This archive was generated by hypermail 2.1.8 : Wed Mar 24 2010 - 05:27:49 PDT