How to reverse char[]?

H. S. Teoh hsteoh at quickfur.ath.cx
Tue Feb 7 17:29:13 PST 2012


Hi all,

I'm trying to reverse a character array. Why doesn't the following work?

	import std.algorithm;
	void main() {
		char[] array = ['a', 'b', 'c'];
		reverse(array);
	}

I get:

Error: template std.algorithm.reverse(Range) if (isBidirectionalRange!(Range) && hasSwappableElements!(Range)) does not match any function template declaration
Error: template std.algorithm.reverse(Range) if (isBidirectionalRange!(Range) && hasSwappableElements!(Range)) cannot deduce template function from argument types !()(char[])


T

-- 
Three out of two people have difficulties with fractions. -- Dirk Eddelbuettel


More information about the Digitalmars-d-learn mailing list