Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2004-07-09 08:44:02


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.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk