Add a 'CAUTION' notice to warn about creating vectors (or other containers

that use copy assignment) of types derived from SerializedType. You
generally don't want to do this anyway due to slicing, but make clear
the other risks. (Field names get mangled.)
This commit is contained in:
JoelKatz
2012-11-26 11:44:04 -08:00
parent 6013d994e2
commit 885925a83b

View File

@@ -12,6 +12,14 @@
#include "InstanceCounter.h"
#include "Log.h"
// CAUTION: Do not create a vector (or similar container) of any object derived from
// SerializedType. Use Boost ptr_* containers. The copy assignment operator of
// SerializedType has semantics that will cause contained types to change their names
// when an object is deleted because copy assignment is used to "slide down" the
// remaining types and this will not copy the field name. Changing the copy assignment
// operator to copy the field name breaks the use of copy assignment just to copy values,
// which is used in the transaction engine code.
enum PathFlags
{
PF_END = 0x00, // End of current path & path list.