Hello *!

As already asked many times in the list about the broken HAS_XXX (BOOST_MPL_HAS_XXX_TRAIT_DEF) mpl I would like to ask following:


If I use this code (on MSVC 7.1 compiler) and I have a type like:

struct test { int xxx; };


and use the macro

namespace x
{
   BOOST_MPL_HAS_XXX_TRAIT_DEF(xxx);
}


This will result in the following code fragment:

--------------------------------------------------------------------------------------------
/// included code from has_xxx.hpp
namespace boost
{
  namespace mpl
  {
    namespace aux
    {
      template< typename T > struct msvc71_sfinae_helper
      {
        typedef void type;
      };
    }
  }
}


namespace sn
{
  template< typename T, typename U = void >
  struct has_xxx_impl_
  {
    static const bool value = false;
    typedef boost::mpl::bool_<value> type;
  };

  template< typename T >
  struct has_xxx_impl_< T , typename boost::mpl::aux::msvc71_sfinae_helper< typename T::xxx >::type >
  {
    static const bool value = true;
    typedef boost::mpl::bool_<value> type;
  };


  template< typename T, typename fallback_ = boost::mpl::bool_<false> >
  struct has_xxx : has_xxx_impl_<T>
  { };
}
--------------------------------------------------------------------------------------------------

For me this will clearly fail, since T::xxx is not a type but an integer member of the struct. If xxx would be a member function it would not be a type as well, so has_xxx can only determine if there is some nested class type or a typedef within the inspected type. Is this correct?


Many thanks,
Ovanes