Fixed for gcc 4 - really!

This commit is contained in:
jez_higgins 2005-08-22 10:35:43 +00:00
parent 2f958b21e9
commit 14e1d2c4e9
2 changed files with 14 additions and 18 deletions

View file

@ -1,7 +1,7 @@
#################################### ####################################
# ARABICA CONFIG # ARABICA CONFIG
# edit for your parser choice - may include more than one USE_* # edit for your parser choice - may include more than one USE_*
PARSER_CONFIG = -DUSE_EXPAT PARSER_CONFIG = -DUSE_EXPAT -DARABICA_NO_WCHAR_T
#PARSER_CONFIG = -DUSE_EXPAT -DUSE_LIBXML2 -DUSE_XERCES -DUSE_GARDEN #PARSER_CONFIG = -DUSE_EXPAT -DUSE_LIBXML2 -DUSE_XERCES -DUSE_GARDEN
#################################### ####################################
@ -42,8 +42,8 @@ DYNAMIC_LIBS = -lexpat -lstdc++
# link flag to create a shared library # link flag to create a shared library
LINK_SHARED = -shared LINK_SHARED = -shared
EXESUFFIX = EXESUFFIX = .exe
LIBSUFFIX = .so LIBSUFFIX = .dll

View file

@ -329,25 +329,21 @@ string_type nodeStringValue(const DOM::Node<string_type>& node)
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
namespace impl {
template<typename RT, typename string_type> struct value_of_node {
RT operator()(const DOM::Node<string_type>& node) { return nodeStringValue(node); }
};
template<typename string_type> struct value_of_node<double, string_type> {
double operator()(const DOM::Node<string_type>& node) { return nodeNumberValue(node); }
};
} // namespace impl
template<class Op, class string_type> template<class Op, class string_type>
class compareNodeWith class compareNodeWith
{ {
typedef typename Op::first_argument_type T; typedef typename Op::first_argument_type T;
// 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<typename RT, typename dummy = void> struct value_of_node {
RT operator()(const DOM::Node<string_type>& node);
};
template<typename dummy> struct value_of_node<string_type, dummy> {
string_type operator()(const DOM::Node<string_type>& node) { return nodeStringValue(node); }
};
template<typename dummy> struct value_of_node<double, dummy> {
double operator()(const DOM::Node<string_type>& node) { return nodeNumberValue(node); }
};
public: public:
compareNodeWith(const T& value) : value_(value) { } compareNodeWith(const T& value) : value_(value) { }
@ -355,7 +351,7 @@ public:
bool operator()(const DOM::Node<string_type>& node) bool operator()(const DOM::Node<string_type>& node)
{ {
value_of_node<T, void> nv; impl::value_of_node<T, string_type> nv;
return Op()(nv(node), value_); return Op()(nv(node), value_);
} // operator() } // operator()