C++-ify the entity formerly known as |struct task|.

I intended this to be a sed-script rewrite, and it almost was
... except that RB_TREE and TAILQ aren't compatible with C++ classes.
So those had to be dropped earlier than originally planned.

Yak-shaving for #613.