From: XeCycle Newsgroups: comp.lang.c++ Subject: Re: Any way to bind an object with an integer References: <54106ae2-c52c-4e83-aabf-5c34ba415019@m19g2000yqh.googlegroups.com> Date: Tue, 22 Nov 2011 12:04:56 +0800 Message-ID: <87aa7oby53.fsf@gmail.com> User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.91 (gnu/linux) Cancel-Lock: sha1:MfsYZx86yXonK2H3Zo3AzKO8Ykg= MIME-Version: 1.0 Content-Type: text/plain NNTP-Posting-Host: $$5lonjgdxpj7l67.news.x-privat.org Organization: X-Privat.Org NNTP Server - http://www.x-privat.org Lines: 18 X-Authenticated-User: $$1tz_xxnxz085nc1qk X-Complaints-To: abuse@x-privat.org Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsfeed.datemas.de!newsfeed.x-privat.org!x-privat.org!not-for-mail Xref: x330-a1.tempe.blueboxinc.net comp.lang.c++:11673 Jayden Shui writes: > Hello All, > > I think usually we require to bind an object with a data, such as an > integer. From this object, we can easily and quickly get its bound > integer. std::map requires the object to be compared. Any other way to > do it? Pointer to objects are always comparable. If you don't mind equal objects bound to different integers, this should work for you. -- Carl Lei (XeCycle) Department of Physics, Shanghai Jiao Tong University OpenPGP public key: 7795E591 Fingerprint: 1FB6 7F1F D45D F681 C845 27F7 8D71 8EC4 7795 E591