
9 Jul
2004
9 Jul
'04
1:44 p.m.
Vladimir Prus wrote:
Peter Dimov wrote:
Or maybe we should just use
int cv[] = { 1, 2, 3 }; v.assign( cv, end(cv) );
as I've been doing for years.
That's nice! Do you have an equally simple recipe for std::map initialization?
For maps, I find the sequence of m[ k ] = v; good enough for my needs. A static array of pairs has about the same overhead per line: { k, v }, and dropping this down to just k, v, never seemed critical, considering the low frequency of single-place-hardcoded-init maps.