Is there anything in particular to look out for with dynamic arrays of custom types?
I am trying to create a dynamic array of ConditionParameter (definition below)
ConditionParameter* m_params;
...
m_params = new ConditionParameter[m_numParams];
But the result of the above line is only one new object of type ConditionParameter, the address of which is stored in m_params.
struct ConditionParameter
{
ConditionParameter() :
type(OBJ_TYPE_OBJECT),
semantic(OP_SEMANTIC_TYPE_NONE),
instance(NULL),
attrib(ATTRIB_TYPE_NONE),
value(0)
{}
ConditionParameter(const ConditionParameter& other)
{
attrib = other.attrib;
instance = other.instance;
semantic = other.semantic;
type = other.type;
value = other.value;
}
ConditionParameter& operator = (ConditionParameter& other)
{
attrib = other.attrib;
instance = other.instance;
semantic = other.semantic;
type = other.type;
value = other.value;
return *this;
}
ObjectType type;
OperandSemanticType semantic;
Object* instance;
AttributeType attrib;
int value;
};