Boost logo

Boost :

From: John Maddock (john_maddock_at_[hidden])
Date: 2002-07-16 05:49:34


>
> I have managed to find a workaround, at least for my case. The compiler
> dislikes calls to the regex_traits::is_class function, when it is a static
class
> member and it is called from an object of the class. The workaround is to
call
> the static function without referring to an object.

OK.

> In my case, regex_traits is derived from c_regex_traits<charT>, so I have
> littered boost/regex/detail/regex_format.hpp and
> boost/regex/detail/regex_match.hpp with code that looks like this:
>
> #ifdef BOOST_REGEX_USE_C_LOCALE
> bool b = traits::is_class(*first, traits::char_class_word);
> #else
> bool b = traits_inst.is_class(*first, traits::char_class_word);
> #endif
>
> It's ugly, and there might be a better way to identify the problem with a
config
> macro (e.g., BOOST_REGEX_USE_STATIC_IS_CLASS), but it works for me.

The main problem I see is that your fix will work provided the user is using
the default traits class, and fail for anyone else (maybe very very few
people though). What happens if we conditionally change the traits class
definition so that is_class is non-static?

John Maddock
http://ourworld.compuserve.com/homepages/john_maddock/index.htm


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk