[GCC-XML] compilation pb running gccxml on code using SFINAE
MOSS Sebastian
Sebastian.MOSS at murex.com
Wed Jun 6 19:33:00 EDT 2007
Thanks Brad,
Although - as I said after trying this originally - then the value
member can't be used as a template argument:
> 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'.
i.e.
template <typename T, bool has_nested_value_type = true>
struct register_nested_type
{
typedef typename register_nested_type< typename T::value_type,
has_nested_value_type<typename T::value_type>::value >::value_type
value_type;
};
template <typename T>
struct register_nested_type<T, false>
{
// dumb typedef for termination
typedef T value_type;
};
Again, this compiles on gcc 3.4 (and not gcc 3.3 or gccxml). Can you
suggest a workaround for this?
Thanks again, in advance,
s
-----Original Message-----
From: Brad King [mailto:brad.king at kitware.com]
Sent: Wednesday, June 06, 2007 5:33 PM
To: MOSS Sebastian
Cc: gccxml at gccxml.org
Subject: Re: [GCC-XML] compilation pb running gccxml on code using
SFINAE
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;
public:
static const bool value = (sizeof(helper::template impl<T>(0)) ==
sizeof(typename helper::true_type));
};
-Brad
*******************************
This e-mail contains information for the intended recipient only. It may contain proprietary material or confidential information. If you are not the intended recipient you are not authorised to distribute, copy or use this e-mail or any attachment to it. Murex cannot guarantee that it is virus free and accepts no responsibility for any loss or damage arising from its use. If you have received this e-mail in error please notify immediately the sender and delete the original email received, any attachments and all copies from your system.
More information about the gccxml
mailing list