Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #11673

Re: Any way to bind an object with an integer

From XeCycle <xecycle@gmail.com>
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 2011-11-22 12:04 +0800
Message-ID <87aa7oby53.fsf@gmail.com> (permalink)
Organization X-Privat.Org NNTP Server - http://www.x-privat.org

Show all headers | View raw


Jayden Shui <jayden.shui@gmail.com> 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

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Any way to bind an object with an integer Jayden Shui <jayden.shui@gmail.com> - 2011-11-19 14:37 -0800
  Re: Any way to bind an object with an integer Victor Bazarov <v.bazarov@comcast.invalid> - 2011-11-21 12:04 -0500
  Re: Any way to bind an object with an integer XeCycle <xecycle@gmail.com> - 2011-11-22 12:04 +0800
  Re: Any way to bind an object with an integer SG <s.gesemann@gmail.com> - 2011-11-22 01:09 -0800

csiph-web