Template classes

Andrew Spott andrew.spott at gmail.com
Tue Apr 14 14:01:28 PDT 2009


So, the attached is supposed to be a class that creates a vector of any type (I would like it to only take numerical values (int, float, real, double, etc), however, I am ok with it taking others (not that I see why someone would use it that way).

I tried to compile it with the following, but it won't compile.  I don't really understand the errors I'm getting either.

Can someone tell me what I'm doing wrong?  If you need more information, let me know.

-Andrew

void testvector() {
	auto v = new Vector!(float)(3, 12.0);
	writefln(v.toString());
	int n = 0;
	
	while (n < n.size()) {
		v[n] = n;
	}
	
	writefln(v.toString());

}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vector.d
Type: application/octet-stream
Size: 517 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20090414/1bde8b9f/attachment.obj>


More information about the Digitalmars-d-learn mailing list