* stl set
@ 2006-05-18 21:25 Aseem Rastogi
2006-05-19 1:38 ` Andreas Pfeil
0 siblings, 1 reply; 2+ messages in thread
From: Aseem Rastogi @ 2006-05-18 21:25 UTC (permalink / raw)
To: gcc-help
Hi,
I am a bit confused about STL sets. STL set takes a comparator function
as input which returns true if first argument is less than second
argument, false otherwise. How does this detect equal elements ?
For eg. set<int> will not allow one int to be inserted twice. How does
it check for equality when comparator function doesn't provide that info ?
I tries to go through set code in stl_set.h but couldn;t get anything.
Thanks in advance.
Regards,
Aseem.
--
Nothing will work unless u do.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: stl set
2006-05-18 21:25 stl set Aseem Rastogi
@ 2006-05-19 1:38 ` Andreas Pfeil
0 siblings, 0 replies; 2+ messages in thread
From: Andreas Pfeil @ 2006-05-19 1:38 UTC (permalink / raw)
To: Aseem Rastogi, gcc-help
[-- Attachment #1: Type: text/plain, Size: 990 bytes --]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
It does so by comparing twice:
if a is not smaller b and b is not smaller a, then obviously they have
to be equal with respect to this comparison function.
Andreas
Aseem Rastogi wrote:
> Hi,
>
> I am a bit confused about STL sets. STL set takes a comparator function
> as input which returns true if first argument is less than second
> argument, false otherwise. How does this detect equal elements ?
>
> For eg. set<int> will not allow one int to be inserted twice. How does
> it check for equality when comparator function doesn't provide that info ?
>
> I tries to go through set code in stl_set.h but couldn;t get anything.
>
> Thanks in advance.
>
> Regards,
> Aseem.
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFEbSGKmz2azRoltLYRAl/oAJ4+Dv12Liy+5N2eukHBH1IjUOKywACfUiMB
3ZV7Ckeb3Oryy2Ge+sxxIA0=
=dZQo
-----END PGP SIGNATURE-----
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/x-pkcs7-signature, Size: 3929 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-05-19 1:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-18 21:25 stl set Aseem Rastogi
2006-05-19 1:38 ` Andreas Pfeil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).