Array functionality and higher order functions in templated C++ code.

Array++ is a very interesting attempt to introduce powerful arrays into the C++ language. While C style pointers have a certain beauty in their nakedness, the C++ standard library std::array does little more than wrap iterators and a size around an old fashioned pointer, and in my experience leave the user quite unsatisfied. At the core of Array++ is the marriage of lightweight C concepts, such as function pointers, simple objects, and lightweight performant design with generically typed higher order functions.

Array++ adds higher order functions to C style arrays, and does so in a light manner that should be familiar to both C programmers and users of functional languages. Map, zip, filter and fold all work in the expected manner, and even manage to one up their C counterparts (in performance and ease of use) with typed closures, though filter map return newly allocated arrays that the user takes responsibilty for. These memory semantics should be unsurprising to those accustomed to manual memory management.

Performance is key in Array++, and the code is littered with assertions, but the entire framework is designed from the ground up to produce release code as performant as possible. Array++ is still in the early stages of development, so don't hesitate to contact me with advice or assistance.

Code Examples:

//Odd numbers from 0 to 99
Array allNumbers = count(100);
Array newArr = allNumbers.filter([](int v){return v % 2 == 1;});

//Vector distance
double data[4] = {2, -2, 2, -2};
Array arr = Array(data, 4);

double length = sqrt(arr.fold([](double sum, double next){return sum + next * next;}, 0));

(Code on GitHub).