KdTree Example

I’m trying to run this example but i have some issues with an error right here. Can you help me?

The error is related to the push_back

int index = 0;
for (unsigned int i = 0; i < 2; i++)
{
MembershipFunctionType::Pointer membershipFunction = MembershipFunctionType::New();
MembershipFunctionType::CentroidType centroid(sample->GetMeasurementVectorSize());
for (unsigned int j = 0; j < sample->GetMeasurementVectorSize(); j++)
{
centroid[j] = estimatedMeans[index++];
}
membershipFunction->SetCentroid(centroid);
membershipFunctionVector.push_back(membershipFunction); //ERROR
}
classifier->SetMembershipFunctions(membershipFunctionVectorObject);

How is membershipFunctionVector defined? And what is the exact error message?

membershipFunctionVector is defined by:

MembershipFunctionVectorType & membershipFunctionVector = membershipFunctionVectorObject->Get();

Error is about allocation, i will update you soon to give you more info about that