Charge-transfer materials for electrochemical water desalination, ion separation and the recovery of elements