ppareto2 rewritten in C++