470,848 Members | 1,751 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,848 developers. It's quick & easy.

map of objects

Why given this:

C c(5, 6, 7); // C has two ctors: one takes 3 ints, one a single int.
map<int, CTestMap;

is this ok?

TestMap.insert(make_pair(1, c));

but not this?

TestMap[1] = c;

Thanks
--
Derek
Jun 27 '08 #1
1 1018
* DerekBaker:
Why given this:

C c(5, 6, 7); // C has two ctors: one takes 3 ints, one a single int.
map<int, CTestMap;

is this ok?

TestMap.insert(make_pair(1, c));

but not this?

TestMap[1] = c;

Thanks
Never mind, should have read my Josuttis first. Adding a default constructor works fine.

--
Derek
Jun 27 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by dasod | last post: by
9 posts views Thread by Aguilar, James | last post: by
8 posts views Thread by Lüpher Cypher | last post: by
161 posts views Thread by KraftDiner | last post: by
21 posts views Thread by George Exarchakos | last post: by
27 posts views Thread by SasQ | last post: by
14 posts views Thread by Jess | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.