4 ms·
That's unfair! The algorithm is in the function "escape", not the function "fractal". escape's function signature is much simpler: int escape(std::complex
by Jabbles 14y ago
That's unfair! The algorithm is in the function "escape", not the function "fractal".
escape's function signature is much simpler:
int escape(std::complex<double> c, int iter_max, const std::function<std::complex<double>(std::complex<double>,
std::complex<double>)> &func)
At least we get to use "auto" when we define func, though:
auto func = [] (std::complex <double> z, std::complex<double> c) -> std::complex<double> {return z * z * z + c; };
- alpatters 14y agoYou could always let the compiler work it out for you. template< typename Func > int escape(std::complex<double> c, int iter_max, Func& func)