The distribution of sexual function in the flowering plant: from monoecy to dioecy