|
Prev: map of classes
Next: ostream_iterator
From: DerekBaker on 19 Apr 2008 17:17 * 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 -- Derek
From: DerekBaker on 19 Apr 2008 17:29 * 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. -- Derek
|
Pages: 1 Prev: map of classes Next: ostream_iterator |