A polymer comprising structural units of Formulae ; (3'A); optionally ; and optionally , wherein the structural units of Formulae , , (3'A) and have the structures: wherein: R 11 are each independently a quaternary ammonium or phosphonium group or a nitrogen-containing heterocyclic group or a salt thereof, the quaternary ammonium or phosphonium group having the formula : and the nitrogen-containing heterocyclic group being an optionally substituted pyrrole, pyrroline, pyrazole, pyrazoline, imidazole, imidazoline, triazole, pyridine, triazine, pyrazine, pyridazine, pyrimidine, azepine, quinoline, piperidine, pyrrolidine, pyrazolidine, imidazolidine, azepane, isoxazole, isoxazoline, oxazole, oxazoline, oxadiazole, oxatriazole, dioxazole, oxazine, oxadiazine, isoxazolidine, morpholine, thiazole, isothiazole, oxathiazole, oxathiazine, or caprolactam, wherein each substituent is independently alkyl, alkenyl, alkynyl, aryl, or aralkyl; R 20 , R 30 , R 40 , R 50 , R 60 , R 70 , R 80 , R 90 , R 130 , R 140 , R 150 , R 160 , and R 170 are each independently hydrogen, halide, alkyl, alkenyl, alkynyl or aryl, and the alkyl, alkenyl, alkynyl or aryl are optionally substituted with halide, and wherein R 30 and R 60 are optionally linked to form a five membered ring optionally substituted with halide or alkyl; each R 100 is independently alkyl, alkenyl, alkynyl, or a substituent having formula : and the alkyl, alkenyl, or alkynyl are optionally substituted with fluoride; R 180 and R 240 are each independently alkylene; R 190 , R 200 , R 210 , R 220 , and R 230 are each independently alkyl, alkenyl, or alkynyl; q is 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, or 20; m is 0, 1, 2, 3, 4, 5 or 6; n is 0, 1, 2 or 3; each m' and each n' is independently 0, 1 or 2; each n' is independently 0, 1 or 2; X - is an anion; and Z is P when the structural unit of formula is present in the polymer but the structural unit of formula (3'A) is not present in the polymer, and Z is N or P when the structural unit of formula (3'A) is present in the polymer. R 11 are each independently a quaternary ammonium or phosphonium group or a nitrogen-containing heterocyclic group or a salt thereof, the quaternary ammonium or phosphonium group having the formula : and the nitrogen-containing heterocyclic group being an optionally substituted pyrrole, pyrroline, pyrazole, pyrazoline, imidazole, imidazoline, triazole, pyridine, triazine, pyrazine, pyridazine, pyrimidine, azepine, quinoline, piperidine, pyrrolidine, pyrazolidine, imidazolidine, azepane, isoxazole, isoxazoline, oxazole, oxazoline, oxadiazole, oxatriazole, dioxazole, oxazine, oxadiazine, isoxazolidine, morpholine, thiazole, isothiazole, oxathiazole, oxathiazine, or caprolactam, wherein each substituent is independently alkyl, alkenyl, alkynyl, aryl, or aralkyl; R 20 , R 30 , R 40 , R 50 , R 60 , R 70 , R 80 , R 90 , R 130 , R 140 , R 150 , R 160 , and R 170 are each independently hydrogen, halide, alkyl, alkenyl, alkynyl or aryl, and the alkyl, alkenyl, alkynyl or aryl are optionally substituted with halide, and wherein R 30 and R 60 are optionally linked to form a five membered ring optionally substituted with halide or alkyl; each R 100 is independently alkyl, alkenyl, alkynyl, or a substituent having formula : and the alkyl, alkenyl, or alkynyl are optionally substituted with fluoride; R 180 and R 240 are each independently alkylene; R 190 , R 200 , R 210 , R 220 , and R 230 are each independently alkyl, alkenyl, or alkynyl; q is 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, or 20; m is 0, 1, 2, 3, 4, 5 or 6; n is 0, 1, 2 or 3; each m' and each n' is independently 0, 1 or 2; each n' is independently 0, 1 or 2; X - is an anion; and Z is P when the structural unit of formula is present in the polymer but the structural unit of formula (3'A) is not present in the polymer, and Z is N or P when the structural unit of formula (3'A) is present in the polymer. <EOS>