real: implement the safe_cast() specialisation.