Boost logo

Boost Users :

Subject: Re: [Boost-users] [MPL] has_xxx always returns false!
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2010-08-25 21:58:19


Eric wrote:
> This code:
> <snip>
> if I understand correctly, this code is suppose to do call a different
> "getNormal" method if the method "normal" exists (or not) in the template
> parameter class.
> Basically mimicking the infamous "__if_exists" macro on the Microsoft c++
> compiler.... right?
> but, has_normal<VT> always return false (visual studio 2008) so we don't get the
> right expected behavior!

has_normal checks for a nested *type* called normal,
not for a member function.

#include <boost/mpl/has_xxx.hpp>
#include <boost/mpl/assert.hpp>


struct test1 {};
struct test2 { typedef void normal; };
struct test3 { int normal(); };

int main() {

In Christ,
Steven Watanabe

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at