Move toPTree implementations all to CPP.