Question

I am trying to insert rectangle objects to a tree. This is the implementation of insert function.

void TwoDimTree::insertNewNode(Rectangle dataIn)
{
insertNewRectangleUtility((&tree), dataIn); 
}


void TwoDimTree::insertNewRectangleUtility(TwoDimTree** temp, Rectangle dataIn)
{
//code here...

}

Compiler gives error C2664(cannot convert parameter 2 from Rectangle to Rectangle) in third line:

 insertNewRectangleUtility((&tree), dataIn);

What should I do?

Was it helpful?

Solution

Given the error message, I would bet on an explicit, private, or deleted copy constructor. Mostly likely, the copy constructor is explicit in which case you can copy Rectangle explicitly but not implicitly like when passing objects of type Rectangle as argument or when returning them from functions. Since you haven't posted the definition of the class Rectangle I can't tell for sure, though.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top