Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Any way to bind an object with an integer

Reply
Thread Tools

Any way to bind an object with an integer

 
 
Jayden Shui
Guest
Posts: n/a
 
      11-19-2011
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?

Thank you very much for your kind help!

Best regards,

Jayden

 
Reply With Quote
 
 
 
 
Victor Bazarov
Guest
Posts: n/a
 
      11-21-2011
On 11/19/2011 5:37 PM, Jayden Shui wrote:
> 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?


A derived class that adds an integer as a data member? You disclose too
little of the requirements to recommend anything specific...

V
--
I do not respond to top-posted replies, please don't ask
 
Reply With Quote
 
 
 
 
SG
Guest
Posts: n/a
 
      11-22-2011
On 19 Nov., 23:37, Jayden Shui wrote:
>
> 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.


What do you mean by "bind" and "bound" in this context?

> std::map requires the object to be compared.


It requires the key type to be comparable somehow, yes. Either using
the default predicate -- std::less<key_type> -- or with a custom
predicate. As long as this binary predicate represents a strict weak
ordering you'll be fine.

> Any other way to do it?


What is "it" ?

Cheers!
SG
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
is there a way to AutoParse a string to another type - e.g. if aDate format then date, else if integer than Integer etc ????? Greg Hauptmann Ruby 6 08-06-2008 04:52 PM
confused by boost::bind & boost::lambda::bind XHengDF@gmail.com C++ 0 05-29-2007 04:37 AM
501 PIX "deny any any" "allow any any" Any Anybody? Networking Student Cisco 4 11-16-2006 10:40 PM
Finding a way to bind ASP.NET controls(two way) to a typed-dataset novus ASP .Net Web Controls 9 12-14-2005 06:07 AM
Using a data-bind dropdownlist to populate another data-bind dropdownlist mr2_93 ASP .Net 1 10-02-2005 05:07 PM



Advertisments