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?

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top