Boost logo

Boost :

From: Matthew Vogt (mvogt_at_[hidden])
Date: 2004-03-02 21:42:36


Matthew Vogt <mvogt <at> juptech.com> writes:

> Anyway, I think some reasonably clean syntax can be found to bind both the
> arguments and the return address into the function call, provided that the
> return address is a method in the invoking object.
>

Well, after some fiddling, the best I can manage is:

class SomeClass
{
public:
  std::string value(int id) { return "foo"; }
}

class ThatServant : public reactive<ThatServant>, private SomeClass
{
public:
  ThatServant() : getValue(&ThatServant::value, this) {}

  method<std::string (int)> getValue;
};

class ThisServant : public reactive<ThisServant>
{
public:
  void findAndStoreValue(ThisServant& other, int id)
  {
    (return_to(&ThisServant::storeValue, this)) = other.getValue(int);
  }
 
private:
  void storeValue(std::string value) { ... }
}

Matt


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk