By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,148 Members | 1,339 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,148 IT Pros & Developers. It's quick & easy.

STL sets and MultiSets

P: n/a
Ok, I need a good online tutorial for STL sets and Multisets. Because the
following line of code should work right

multiset<myClass> foo;
myClass fubu;
foo.insert(fubu);

or am I doing something wrong.

Thanks a lot.
Jul 22 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"nadz" <jn***@lsol.net> wrote in message
news:vs************@corp.supernews.com...
Ok, I need a good online tutorial for STL sets and Multisets. Because the following line of code should work right

multiset<myClass> foo;
myClass fubu;
foo.insert(fubu);

or am I doing something wrong.

Thanks a lot.


Have you got a "bool operator<(const myClass& rhs) const"
for myClass?
Jul 22 '05 #2

P: n/a
John Ericson wrote:
"nadz" <jn***@lsol.net> wrote in message
news:vs************@corp.supernews.com...
Ok, I need a good online tutorial for STL sets and


Multisets. Because the
following line of code should work right

multiset<myClass> foo;
myClass fubu;
foo.insert(fubu);

or am I doing something wrong.

Thanks a lot.

Have you got a "bool operator<(const myClass& rhs) const"
for myClass?

Or, depending on the nature of myClass, a friend function:

bool operator<(const myClass& lhs, const myClass& rhs);

See -> http://www.parashift.com/c++-faq-lit....html#faq-14.5

- Adam

--
Reverse domain name to reply.

Jul 22 '05 #3

P: n/a
I forgot the const...2 hours of a staring at a computer screen because I
forgot five letters. Thanks for your help guys.

~Justin
"Adam Fineman" <af******@retupmoc.org> wrote in message
news:iI*****************@news.uswest.net...
John Ericson wrote:
"nadz" <jn***@lsol.net> wrote in message
news:vs************@corp.supernews.com...
Ok, I need a good online tutorial for STL sets and


Multisets. Because the
following line of code should work right

multiset<myClass> foo;
myClass fubu;
foo.insert(fubu);

or am I doing something wrong.

Thanks a lot.

Have you got a "bool operator<(const myClass& rhs) const"
for myClass?

Or, depending on the nature of myClass, a friend function:

bool operator<(const myClass& lhs, const myClass& rhs);

See -> http://www.parashift.com/c++-faq-lit....html#faq-14.5

- Adam

--
Reverse domain name to reply.

Jul 22 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.