News for hackers. Stuff that matters.
Re:Mandelbrot set in C++11 by crawshaw on Thursday February 28, 2013 @09:31AM (#5298761)
C++ is amazingly distracting. There's an algorithm in here, but it's hard to see through all the

void fractal(window<int> &scr, window<double> &fract, int iter_max, std::vector<int> &colors, const std::function<std::complex<double(std::complex<double>, std::complex<double>)> &func, const char *fname, bool smooth_color);

Re:Mandelbrot set in C++11 by Jabbles on Thursday February 28, 2013 @09:44AM (#5298832)
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; };
Re:Mandelbrot set in C++11 by alpatters on Thursday February 28, 2013 @10:23AM (#5299013)
You could always let the compiler work it out for you.

template< typename Func > int escape(std::complex<double> c, int iter_max, Func& func)

Re:Mandelbrot set in C++11 by lclarkmichalek on Thursday February 28, 2013 @09:38AM (#5298804)
Does slightly seem like some typedefs might have helped. Particularly the `func` type signature.