[GCC-XML] compilation pb running gccxml on code using SFINAE

Brad King brad.king at kitware.com
Wed Jun 6 17:33:24 EDT 2007

MOSS Sebastian wrote:
> The code I posted was a complete example in itself - ie no use of Boost
> macros. I tried the static const approach as well - as I'm using some
> template specializations using has_nested_value_type<>::value - I got
> the complementary error 'non-const type cannot be used as a template
> param'.
> So ultimately I guess this is a limitation with gcc3.3 right?

Here is a different implementation that works in gcc versions all the
way back to 2.95:

template <typename T>
struct has_nested_value_type_helper
  typedef char (&true_type)[1];
  typedef char (&false_type)[2];
  template <class U> true_type  static impl(typename U::value_type const*);
  template <class U> false_type static impl(...);

template <typename T>
class has_nested_value_type
  typedef has_nested_value_type_helper<T> helper;
  static const bool value = (sizeof(helper::template impl<T>(0)) ==
                             sizeof(typename helper::true_type));


More information about the gccxml mailing list