Boost logo

Boost Users :

Subject: Re: [Boost-users] static reflection
From: James Pritts (jbpritts_at_[hidden])
Date: 2008-09-17 23:14:58


Sorry for top posting here, but I didn't receive Steven's response.
I'm using i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build
5488).

The compile error I get is the following:

g++ -I/Users/jpritts/trunk/LIFEBLAST_HOME/i386-darwin-gcc-4_0/vendor/Boost/include
main.cc -o a.out
main.cc: In instantiation of 'DoesVisitorImplement<Derived, void, float>':
main.cc:47: instantiated from here
main.cc:22: error: '&Base::operator()' is not a valid template
argument for type 'void (Derived::*)(float)' because it is of type
'void (Base::*)(float)'
main.cc:22: note: standard conversions are not allowed in this context

Thanks,
  Jimmy.

AMDG
James Pritts wrote:
> On a boost thread a while ago, I saw some code to query for the
> existence of a member function of a class using SFINAE and
> BOOST_STATIC. I guess you could call it static reflection. Below is
> a code snippet that does not work using the aforementioned methods.
> The culprit is the using Base::operator() statement in the Derived
> class. Apparently the base class method void operator()(float u) is
> not part of the type of Derived. This was a shock to me, because you
> can call the overloaded method from the derived class. I'd appreciate
> any advice on how to check for the existence of member functions in
> this scenario. I fear it may be impossible. Thanks!
>
You can convert a member function pointer of a derived class
to a member function pointer of a derived class, so it ought to work.
What compiler are you using?
I get
1
1
Using msvc 9.0.
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