我有點卡住使用指針委託集。我的代碼如下:指針代表在STL集
void Graph::addNodes (NodeSet& nodes)
{
for (NodeSet::iterator pos = nodes.begin(); pos != nodes.end(); ++pos)
{
addNode(*pos);
}
}
這裏NODESET被定義爲:
typedef std::set<Node_ptr, Node_ptr_Sorting_Predicate> NodeSet;
上面這段代碼工作完全在我的Windows機器上,但是當我運行在MAC上的同一段代碼,它給了我下面的錯誤:
no matching function for call to '
Graph::addNode(const boost::shared_ptr<Node>&)
'
僅供參考,Node_ptr的類型爲:typedef boost::shared_ptr<Node> Node_ptr;
有人可以告訴我爲什麼會發生這種情況嗎?
*有*一個'圖:: ADDNODE(常量的boost :: shared_ptr的&)'方法? –
sth
2010-05-17 21:33:59
bool Graph :: addNode(Node_ptr&node) 這是Graph :: addnode()的聲明 – ananth 2010-05-17 21:58:20
@seth:no there'nt。 – ananth 2010-05-17 22:01:19