I haven't coded in C++ in several years. I'm writing some more serious modules now and I've forgotten most of it. I'm relearning how spoiled I am in these silly interpreted languages. Can't break to a label? using namespace std;? #include or #include "math.h" or #include or ...? don't forget that main function. I should stop before I
(
Read more... )
Comments 10
-tanjent
Reply
For instance, how do I get some Perl map-like functionality? Or is that just too Perlish? It seems amusing to redefine the container class with a map function. That might be quite a challenge. I don't know if I can pass an arbitrary block of code in C++, or just functions.
Not that I need a map function yet, but I'd probably use it if it were easy to make.
Reply
Reply
The map function an operation in individual elements of a vector. It takes a code block and an array, and transmuted each element of the array by the code block and returns the new array. For instance:
@inverted = map { ! $_ } @boolean_array;
This effectively inverts a bit vector.
It's unlikly that C++ can accomplish such a thing with the fluency of Perl. It probably can't even match Python's version of map (called filter). You can read Perl's version here.
Reply
Reply
Reply
Reply
Reply
Leave a comment