Home > General Development > Imperfect C++: Functors and Ranges Imperfect C++: Functors and Ranges Eugenia Loli 2004-11-08 General Development 9 Comments In most cases, functors and ranges cause a minor issue of too many keystrokes, but in some cases, they can cause a serious impediment to maintainability. This chapter will teach you to deal with this problem while it’s still a minor one. About The Author Eugenia Loli Ex-programmer, ex-editor in chief at OSNews.com, now a visual artist/filmmaker. Follow me on Twitter @EugeniaLoli 9 Comments 2004-11-08 8:02 pm What the functor? I’m a C/C++ programmer and after about 2 minutes I still don’t under stand this. 2004-11-08 8:16 pm Apparently a functor is a class with the operator() defined for it as a member function. Invoking such operator() looks like a function call. 2004-11-09 12:12 am http://en.wikipedia.org/wiki/Function_object in particular see the notes regarding prolog and ML 2004-11-09 8:30 pm That’s the point… C++ is the magic language too bloated and far too complicated… Of course fuctional programming theory is not the nail to C++ coffin, but if C++ programer with practice has troubles with language mechanisms (I’m sure 90% of programmers would fail serious C++ exam with all elements of language involved) the language is poor… Nowadays, C++ has being gone – professionals choose cleaner C# and Java… 2004-11-09 8:46 pm C++ is like any other language, good for some things, poor for others. Real “professionals” will always choose the best tool for the job. For some applications, that tool is C++. 2004-11-09 8:48 pm Yes, functors in C++ are objects that can be used in some situations where functions are expected. For example, many STL algorithms (find_if, remove_if, etc etc) take functions or functors as arguments. Take a look at STL’s std::unary_function and std::binary_function. 2004-11-12 7:15 am 90% of games are written in C++. Java, besides being interpeted, only allows one superclass and no function overloading- too weak. 2004-11-12 7:16 am corrrection, operator overloading. Sorry, its late 2004-11-12 10:59 am Nowadays, C++ has being gone – professionals choose cleaner C# and Java… If you say something often enough, it will become true, right?