[LLVMdev] Adding DenseMap::FindAndConstruct with a default value

Matthijs Kooijman 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...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080606/56837638/attachment.sig>

More information about the llvm-dev mailing list