
Jonathan Turkanis writes:
"David Abrahams" <dave@boost-consulting.com> wrote in message news:upt6z5s2f.fsf@boost-consulting.com...
"Jonathan Turkanis" <technews@kangaroologic.com> writes:
I wouldn't count on any member detection with VC6. I little works
with
V7.0.
You can detect type members on vc6. See mpl/aux_/has_xxx.hpp.
I'm familiar with the implementation of has_xxx, but I was pretty sure it didn't work on VC6
Among other things, "has_xxx.hpp" contains MSVC 6.0-specific implementation.
....
In fact, the test program at the end of this message compiles fine on VC6, but should static assert if has_xxx is supported. Am I doing something wrong?
Yep, please see below.
By the way, I have an implementation of has_template_xxx, which detects member templates. It works on all my SFINAE-capable compilers -- seven, at last count -- but I'm afraid it's probably not standard-conforming.
You don't imply that a conforming implementation is not possible, do you?
Any interest?
After the release, sure. [...]
#include <boost/mpl/aux_/has_xxx.hpp> #include <boost/static_assert.hpp>
struct S { };
struct T {
^ That's a really unfortunate choice of name. One of the MSVC 6.0's peculiar bugs is this: struct T {}; template< typename T > struct her : T {}; // inherits from *global* T!
typedef int kids; };
BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(has_kids, kids, true)
int main() { BOOST_STATIC_ASSERT(has_kids<S>::value); // Should fail.
If you rename 'T' to something else, it will.
BOOST_STATIC_ASSERT(has_kids<T>::value); }
-- Aleksey Gurtovoy MetaCommunications Engineering