In all cases of sales in partition, when it appears that any person has a vested or contingent future right or estate therein, the court shall ascertain and settle the proportionate value of such contingent or vested right or estate, and shall direct such proportion of the proceeds of sale to be invested, secured or paid over in such manner as to protect the rights and interests of the parties.