|
Boost Users : |
Subject: [Boost-users] overloaded const/non-const functions and bind
From: Andrej van der Zee (andrejvanderzee_at_[hidden])
Date: 2010-03-27 19:52:44
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<R, boost::_mfi::mf0<R, T>, typename
boost::_bi::list_av_1<A1>::type> boost::bind(R (T::*)(), A1) [with R =
xmlpp::Element*, T = xmlpp::Node, A1 = boost::arg<1>]
/usr/local/include/boost/bind/bind_mf_cc.hpp:30: note:
boost::_bi::bind_t<R, boost::_mfi::cmf0<R, T>, typename
boost::_bi::list_av_1<A1>::type> boost::bind(R (T::*)()const, A1)
[with R = const xmlpp::Element*, T = xmlpp::Node, A1 = boost::arg<1>]
Is there a way to get the const_iterator? Or is there any other solution?
Thank you,
Andrej
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net