changeset 720:038d8bcdcf93

Ivan Senji <ivan.senji_REMOVE_@_THIS__gmail.com> 2005-10-24 news:djj0eh$132e$1@digitaldaemon.com
author thomask
date Fri, 28 Oct 2005 21:28:36 +0000
parents de0ff320fb08
children 9c56e95b4ec8
files run/t/template_class_11_A.d run/t/template_class_11_B.d
diffstat 2 files changed, 54 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/run/t/template_class_11_A.d	Fri Oct 28 21:28:36 2005 +0000
@@ -0,0 +1,26 @@
+// $HeadURL$
+// $Date$
+// $Author$
+
+// @author@	Ivan Senji <ivan.senji_REMOVE_@_THIS__gmail.com>
+// @date@	2005-10-24
+// @uri@	news:djj0eh$132e$1@digitaldaemon.com
+
+module dstress.run.t.template_class_11_A;
+
+class array(T) {
+	static T[] opIndex(T[] a ...) {
+		return a.dup;
+	}
+}
+
+int main(){
+	float[] f = array!(float)[1, 2, 3];
+
+	assert(f.length == 3);
+	assert(f[0] == 1.0);
+	assert(f[1] == 2.0);
+	assert(f[2] == 3.0);
+
+	return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/run/t/template_class_11_B.d	Fri Oct 28 21:28:36 2005 +0000
@@ -0,0 +1,28 @@
+// $HeadURL$
+// $Date$
+// $Author$
+
+// @author@	Ivan Senji <ivan.senji_REMOVE_@_THIS__gmail.com>
+// @date@	2005-10-24
+// @uri@	news:djj0eh$132e$1@digitaldaemon.com
+
+module dstress.run.t.template_class_11_B;
+
+class array(T) {
+	static T[] opIndex(T[] a ...) {
+		return a.dup;
+	}
+}
+
+int main(){
+	alias array!(float) type;
+
+	float[] f = type[1, 2, 3];
+
+	assert(f.length == 3);
+	assert(f[0] == 1.0);
+	assert(f[1] == 2.0);
+	assert(f[2] == 3.0);
+
+	return 0;
+}