|
-
March 10th, 2005, 12:06 PM
#1
stl set question
hi,
CString buff( "abc" );
std::set< CString > s;
s.insert( buff );
s.insert( buff );
s.insert( buff );
s.insert( buff );
s.insert( buff );
s.insert( buff );
does the set inserts "abc" once ?
thanks
-
March 10th, 2005, 12:17 PM
#2
Re: stl set question
Yes. Just examine s.size()
If you want it inserted more than once, use multiset instead of set
-
March 10th, 2005, 12:24 PM
#3
Re: stl set question
thanks Philip.
let me extend the question, when i insert n items to the set,
and than iterate on the set, do i get the items at the same
order they were inserted ?
-
March 10th, 2005, 12:29 PM
#4
Re: stl set question
No. set orders the items. By default, it uses operator <
but you can provide the constructor with a predicate also.
-
March 10th, 2005, 01:44 PM
#5
Re: stl set question
thanks again
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|