Boost logo

Boost Users :

Subject: Re: [Boost-users] static reflection
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-09-18 11:01:54


AMDG

James Pritts wrote:
> So is the error valid, meaning does the error conform the C++
> standard?

Apparently, it is.

"For a non-type template-parameter of type pointer to member
function, no conversions apply" (13.3.2/5)

> <snip>
>
> Later in the code, I need to check if the static visitor supports a
> type at run time. This is why I need member function introspection,
> and it would have worked save for this one obscure snafu. It works on
> MSCV9 according to Steven, but that does me no good.
>

I think that you can use overload resolution instead of SFINAE (untested).

struct fallback { fallback operator,(int); };

yes is_fallback(fallback);
no is_fallback(...);

template<class C>
struct has_function_call_operator_impl : C {
    using C::operator();
    fallback operator()(...) const;
};

template<class T>
T make();

template<class C, class Arg>
struct has_function_call_operator {
    enum { value =
sizeof(is_fallback(make<has_function_call_operator_impl<C>
>()(make<Arg>()))) == sizeof(no) };
};

In Christ,
Steven Watanabe


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net