overloaded const/non-const functions and bind

Hi,
I want to use a function in bind that has a const and non-const
version named Node::get_parent. I am using the following expression:
NodeSet nodes_whitespace =
doc->get_root_node()->find("//text()[normalize-space()='']");
for_each(nodes_whitespace.begin(), nodes_whitespace.end(),
bind(&Node::remove_child, bind(&Node::get_parent, _1)));
I get the obvious error:
../parsers-refact/trans-full/main.cpp: In function ‘void
remove_whitespace_nodes(xmlpp::Document*)’:
../parsers-refact/trans-full/main.cpp:56: error: call of overloaded
‘bind(<unresolved overloaded function type>, boost::arg<1>&)’ is
ambiguous
/usr/local/include/boost/bind/bind_mf_cc.hpp:20: note: candidates are:
boost::_bi::bind_t

Hi Igor, Thanks for your reply.
You have to cast &Node::get_parent explicitly to one of the available overloads, to resolve ambiguity.
Any pointers on how to do this? My compiler keeps complaining. This is
how I cast:
NodeSet nodes_whitespace =
doc->get_root_node()->find("//text()[normalize-space()='']");
for_each(nodes_whitespace.begin(), nodes_whitespace.end(),
bind(&Node::remove_child,
bind(static_cast

Hi, Sorry for the spam, the member function type was incorrect, the return type was Element* and not Node*. Thank you, Andrej
participants (2)
-
Andrej van der Zee
-
Igor R