[LAD] again [ot] programming c++ problem (functions adresses)

Dominic Sacré dominic.sacre at gmx.de
Mon Jul 16 18:56:59 UTC 2007


> You need something like std::mem_fun.  Have you looked at Boost
> (http://www.boost.org)?  I think boost::mem_fn will do what you want.

Unfortunately that won't work. std::mem_fun and boost::mem_fn create
functors which can be used with STL algorithms and the like, but are
completely different from C functions (or function pointers). The way
they are used looks similar, but it's not the same thing.

There simply is no pretty solution to this problem, you'll have to use
a global (or static member) function in some way...

> You could also cobble something together on your own.  If your
> Midish_rl class is a singleton (i.e. you only allocate one object of
> that type in you program), you could add some static wrapper methods.
> Otherwise, write your own member function adapters classes specific to
> your situation.



More information about the Linux-audio-dev mailing list