[LLVMdev] Adding DenseMap::FindAndConstruct with a default value
matthijs at stdin.nl
Fri Jun 6 00:27:39 PDT 2008
> Assuming the default value is not a valid entry in your map (for instance,
> if you're using pointers), you can do:
> Foo& entry = DenseMap[Key]
> if (entry == DefaultValue)
> entry = constructNewValue();
The problem here is that the DefaultValue is undefined. However, Chris
suggested that the default value, ValueT(), is not undefined but simply zero.
However, on IRC someone was quite positive that it would become undefined.
Anyone that knows for sure (preferably from the language standard, not only
from experience :-)
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 189 bytes
Desc: Digital signature
More information about the llvm-dev