map of objects

D

DerekBaker

Why given this:

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

is this ok?

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

but not this?

TestMap[1] = c;

Thanks
 
D

DerekBaker

* DerekBaker:
Why given this:

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

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top