R
[rob desbois]
I've not really used sequence algorithms before and am having some
trouble interpreting usage from The C++ Programming Language
[Stroustrup].
The effect I'd like to achieve is to copy all entries (key and value)
from map<string, string> source to dest - without overwriting any
entries in dest unless the keys match, ie:
for (map<string, string>::const_iterator p = source.begin(); p !=
source.end(); ++p)
dest[p->first] = dest[p->second];
AFAICT copy would overwrite the first N elements of dest with those of
source, where N = source.size(). Is this correct? Is there an
appropriate sequence algorithm that will achieve the code shown above?
--Rob
trouble interpreting usage from The C++ Programming Language
[Stroustrup].
The effect I'd like to achieve is to copy all entries (key and value)
from map<string, string> source to dest - without overwriting any
entries in dest unless the keys match, ie:
for (map<string, string>::const_iterator p = source.begin(); p !=
source.end(); ++p)
dest[p->first] = dest[p->second];
AFAICT copy would overwrite the first N elements of dest with those of
source, where N = source.size(). Is this correct? Is there an
appropriate sequence algorithm that will achieve the code shown above?
--Rob