templates
Ellery Newcomer
ellery-newcomer at utulsa.edu
Mon Apr 19 15:16:29 PDT 2010
On 04/19/2010 02:16 PM, Steven Schveighoffer wrote:
>
> What you are looking for is a conversion from compile-time interface to
> runtime interface. The only drawback is, you can't go backwards (from a
> runtime interface to a compile-time).
That hurts. The thing is, I'm eventually going to need to get that T
back so I can access the non-common parts of it.
The T types already correspond to an enum, so the interface could look like
interface IW{
Type type();
int foo(int);
}
then whenever I want T, I can just test type and perform a cast.
Now I'm thinking of how to express that mapping in a centralized
function or template or whatever, and I think I'm back where I started.
Oh well. I'm probably going to have to write out each case longhand anyways.
It probably isn't important, but aren't dynamic casts rather expensive?
More information about the Digitalmars-d-learn
mailing list