Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
The perfect STL container
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
ArbolOne  
View profile  
 More options Sep 28 2012, 9:25 am
Newsgroups: comp.lang.c++
From: ArbolOne <arbol...@gmail.com>
Date: Fri, 28 Sep 2012 06:25:14 -0700 (PDT)
Local: Fri, Sep 28 2012 9:25 am
Subject: The perfect STL container
Does STL have a container that would allow me to story only one copy of whatever data I am storing? For instance, in a data pool where there are several people named Mike, the container will only allow me to story the first person named Mike.

TIA


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Victor Bazarov  
View profile  
 More options Sep 28 2012, 9:36 am
Newsgroups: comp.lang.c++
From: Victor Bazarov <v.baza...@comcast.invalid>
Date: Fri, 28 Sep 2012 09:35:48 -0400
Local: Fri, Sep 28 2012 9:35 am
Subject: Re: The perfect STL container
On 9/28/2012 9:25 AM, ArbolOne wrote:

> Does STL have a container that would allow me to story only one copy
> of whatever data I am storing? For instance, in a data pool where
> there are several people named Mike, the container will only allow me
> to story the first person named Mike.

Your question is a bit unclear.  What is "a data pool"?  How are you
going to populate your container from the "data pool"?  There is always
more than one way to skin the proverbial cat, and since you mentioned
"people" and storing (I assume you meant "store" not "story") only "the
first person", do you need to store the whole "person" (whatever you
mean by that) or only the name?  Seems that no matter what container you
end up using, you still need to introduce some kind of discriminating
logic to meet the requirement of storing only the first object, and not
the last [encountered], for instance.

V
--
I do not respond to top-posted replies, please don't ask


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
goran.pu...@gmail.com  
View profile  
 More options Sep 28 2012, 9:38 am
Newsgroups: comp.lang.c++
From: goran.pu...@gmail.com
Date: Fri, 28 Sep 2012 06:38:54 -0700 (PDT)
Local: Fri, Sep 28 2012 9:38 am
Subject: Re: The perfect STL container

On Friday, September 28, 2012 3:25:15 PM UTC+2, ArbolOne wrote:
> Does STL have a container that would allow me to story only one copy of whatever data I am storing? For instance, in a data pool where there are several people named Mike, the container will only allow me to story the first person named Mike.

Look up std::set (hash_set if you have it and don't care about sorting your people).

HTH,

Goran.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rui Maciel  
View profile  
 More options Sep 28 2012, 9:50 am
Newsgroups: comp.lang.c++
From: Rui Maciel <rui.mac...@gmail.com>
Date: Fri, 28 Sep 2012 14:50:09 +0100
Local: Fri, Sep 28 2012 9:50 am
Subject: Re: The perfect STL container

ArbolOne wrote:
> Does STL have a container that would allow me to story only one copy of
> whatever data I am storing? For instance, in a data pool where there are
> several people named Mike, the container will only allow me to story the
> first person named Mike.

It appears you are looking for a unique associative container.  The STL
provides a hand full of those, including std::map and std::set.

Rui Maciel


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »