is_total rewritten in C++