On Sunday, 31 July 2016 at 03:04:27 UTC, Gorge Jingale wrote:
I like to build structures using template mixins because one
can pick and choose functionality at compile time, but still
have a relationship between different types.
It would be really nice if one could sort of test if a template
On 02/22/2012 01:13 AM, BLM wrote:
That last one looks a lot better than my solution. It's certainly a lot clearer.
One problem I discovered with using templates was that I ended up needing
virtual
functions, which means that I had to convert the template functions to mixins
and
just instantia
That last one looks a lot better than my solution. It's certainly a lot clearer.
One problem I discovered with using templates was that I ended up needing
virtual
functions, which means that I had to convert the template functions to mixins
and
just instantiate them for each type (at least there
On Sunday, February 19, 2012 12:34:07 Jacob Carlborg wrote:
> > Template functions are non-virtual. You can't derive from them. If you
> > want
> > the derived classes to have the same functions, you must redefine them in
> > the derived class.
> >
> > - Jonathan M Davis
>
> Yeah, but isn't that
On 2012-02-19 02:07, Jonathan M Davis wrote:
On Sunday, February 19, 2012 00:55:59 %u wrote:
I've been working on porting an old D library to D2, and I'm running into a
nasty issue with templates and inheritance. I've got a base class like this:
class Reader {
void get(T)(ref T[] buffer);
On 02/19/2012 01:55 AM, %u wrote:
I've been working on porting an old D library to D2, and I'm running into a
nasty issue with templates and inheritance. I've got a base class like this:
class Reader {
void get(T)(ref T[] buffer);
}
and a subclass like this:
class SubReader {
void ge
On 02/19/2012 02:23 AM, %u wrote:
I think I got it! This seems to work:
class Derived {
//Pulls in all the template forms in the base class
template get(args ...) {
alias Base.get!args get;
}
//Create new versions of get() here.
}
This kills IFTI for the base clas
On Sunday, February 19, 2012 01:23:13 %u wrote:
> I think I got it! This seems to work:
>
> class Derived {
> //Pulls in all the template forms in the base class
> template get(args ...) {
> alias Base.get!args get;
> }
>
> //Create new versions of get() here.
> }
That se
On Sunday, February 19, 2012 01:17:42 %u wrote:
> Thanks! I guess I'll just have to live with redefining the functions, do
> some sort of interface/mixin thing, or change the class interface. It makes
> sense that template functions aren't virtual (how are you supposed to deal
> with vtables?), but
I think I got it! This seems to work:
class Derived {
//Pulls in all the template forms in the base class
template get(args ...) {
alias Base.get!args get;
}
//Create new versions of get() here.
}
Thanks! I guess I'll just have to live with redefining the functions, do some
sort
of interface/mixin thing, or change the class interface. It makes sense that
template functions aren't virtual (how are you supposed to deal with vtables?),
but I wish that at least an alias declaration could work.
On Sunday, February 19, 2012 00:55:59 %u wrote:
> I've been working on porting an old D library to D2, and I'm running into a
> nasty issue with templates and inheritance. I've got a base class like this:
>
> class Reader {
> void get(T)(ref T[] buffer);
> }
>
> and a subclass like this:
>
>
Correction: redefining in the *subclass*. Silly me.
In the interim, I'm just redefining the template in the base class, but that's a
really annoying hack to have to perform every single time I have to make a new
form of the template.
14 matches
Mail list logo