www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Problem with destroy

reply "Namespace" <rswhite4 googlemail.com> writes:
----
import std.stdio;

struct vec2f {
public:
	float[2] data;
	
	alias data this;
}

void main()
{
	vec2f[] vs;
	foreach (ref vec2f v; vs) {
		.destroy(v);
	}
}
----

/d488/f18.d(14): Error: template object.destroy matches more than 
one template declaration, 
/opt/compilers/dmd2/include/object.di(593):destroy(T)(ref T obj) 
if (is(T == struct)) and 
/opt/compilers/dmd2/include/object.di(604):destroy(T : U[n], U, 
ulong n)(ref T obj)


What is the smartest way for this?
Jul 05 2013
parent "Namespace" <rswhite4 googlemail.com> writes:
Seems I'm a bit stupid today.
That solved my problem:
.destroy!vec2f(v);
Jul 05 2013