Can templated functions be used in interfaces?

Gary Willoughby dev at nomad.so
Thu Jul 11 04:56:15 PDT 2013


I have an interface like this:

interface IAccessor
{
	public ResultSet getCacheData();
	public bool persist(T)(ref T[] collection);
}

Then i'm composing an object constraining via that interface:
...
private IAccessor _accessor

public void setAccessor(IAccessor accessor)
{
     this._accessor = accessor;
}
...

When i call the method like this:

auto x = this._accessor.persist!User(collection);

I get this error:

Undefined symbols for architecture x86_64:
   
"_D7storage9iaccessor9IAccessor29__T7persistTS4data4user4UserZ7persistMFKAS4data4user4UserZb", 
referenced from:
       _D5logic13userprocessor13UserProcessor15persistNewUsersMFZv 
in main.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status

Any idea what i'm doing wrong?


More information about the Digitalmars-d-learn mailing list