Boost logo

Boost Users :

From: Stephen Gross (sgross_at_[hidden])
Date: 2006-02-03 12:51:59


Ok, I want to create a functor that takes no arguments and returns a double.
Furthermore, I want this functor to be composed of functors itself. For
instance:

=============================
struct Foo
{
  double getX() const{ return 5; }
  double getY() const { return 10; }
};

Foo f;

double z = (boost::bind(&Foo::getX, boost::ref(f)) / boost::bind(&Foo::getY,
boost::ref(f))) ();
====================

The above code, however, generates the following error:

error: no match for 'operator/' in 'boost::bind(R (T::*)()
   const, A1) [with R = double, T = Foo, A1 =
   boost::reference_wrapper<Foo>](boost::ref(T&) [with T = Foo]()) /
   boost::bind(R (T::*)() const, A1) [with R = double, T = Foo, A1 =
   boost::reference_wrapper<Foo>](boost::ref(T&) [with T = Foo]())'

Is there a way to make the division operation of two functors work in this
example?

Thanks,
--Steve

Stephen Gross
Case Western School of Medicine
Cleveland, OH

"By Grabthar's hammer, by the sons of Worvan, you shall be avenged." - Dr.
Lazarus


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