|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-12-06 10:36:17
From: <nbecker_at_[hidden]>
> We can use more functions related to complex types. Here's one handy
> one:
>
> template<typename func, typename flt>
> inline std::complex<flt> ComplexApply (func f, std::complex<flt> x) {
> return std::complex<flt> (f (real (x)), f (imag (x)));
> }
>
> Can bind do this?
Yes, bind can be used to emulate the above, but in this case the dedicated
function approach is much clearer.
bind is merely a convenient way to define function objects inline. When the
complexity of the bind() expression reaches a certain point it becomes
easier to simply define the function object "the old way." ;-)
-- Peter Dimov Multi Media Ltd.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk