diff --git a/XPath/impl/xpath_object.hpp b/XPath/impl/xpath_object.hpp index e6210ecb..8fb10df8 100644 --- a/XPath/impl/xpath_object.hpp +++ b/XPath/impl/xpath_object.hpp @@ -339,13 +339,24 @@ public: bool operator()(const DOM::Node& node) { - return Op()(nodeValue(node), value_); + return Op()(nodeValue()(node), value_); } // operator() private: - template RT nodeValue(const DOM::Node& node); - template<> string_type nodeValue(const DOM::Node& node){ return nodeStringValue(node); } - template<> double nodeValue(const DOM::Node& node) { return nodeNumberValue(node); } + // this is all far more complicated that I'd hoped. I wanted a template function, specialised on + // string_type and double. Instead I have finished up using a class with an operator() which is partially + // specialised on string_type and double with an unused template parameter. + // ho hum - see http://lists.debian.org/debian-gcc/2004/09/msg00015.html or + // google for "explicit specialization in non-namespace scope" + template struct nodeValue { + RT operator()(const DOM::Node& node); + }; + template struct nodeValue { + string_type operator()(const DOM::Node& node) { return nodeStringValue(node); } + }; + template struct nodeValue { + double operator()(const DOM::Node& node) { return nodeNumberValue(node); } + }; T value_; bool operator==(const compareNodeWith&);