"merged" (mapping::merged)
This function creates a new instance by merging two mappings.
Synopsis
mapping mapping.merged(mapping other);
Parameters
Parameter | Description |
---|---|
other | Mapping to be merged. |
Description
The function works similarly to "merge", but creates a new instance. In this case the used mapping will not be changed.
The resulting mapping is a new copy of the used mapping, merged with the "other" mapping given as a parameter.
Example
Merging mappings "map" and "other".
main()
{
mapping m1 = makeMapping("one", 1);
mapping m2 = m1.merged(makeMapping("two", 2));
}
As a result, the mapping "m2" will then contain both key/value pairs:
WCCOAui1:[mapping 2 items
WCCOAui1: "two" : 2
WCCOAui1: "one" : 1
WCCOAui1:]
While the mapping "m2" will still contain the "one" element:
WCCOAui1:[mapping 1 items
WCCOAui1: "one" : 1
WCCOAui1:]
Assignment
Mapping