Feel free to take a look at https://github.com/hpohl/ext/. Maybe
you can find something useful.
struct S {
int value() {
return 1;
}
}
class Base {
S s;
alias s this;
}
class Derived : Base {
void func() {
int i = value();
}
}
Fails with main.d(14): Error: undefined identifier value.
Explicitly casting this to Base works:
void func() {
I've ended up with a TypeTuple storing 1230 auto-generated types.
Now the compiler claims there is a recursive template expansion.
How to stir him from his resolve?
On Friday, 17 August 2012 at 22:01:42 UTC, Jonathan M Davis wrote:
On Friday, August 17, 2012 23:45:49 Henning Pohl wrote:
I've ended up with a TypeTuple storing 1230 auto-generated
types.
Now the compiler claims there is a recursive template
expansion.
How to stir him from his resolve?
I
On Friday, 17 August 2012 at 22:28:12 UTC, bearophile wrote:
Henning Pohl:
I want to store lots (~615) dynamically loaded function
pointers in a class and call them using opDispatch. To provide
a type-safe function call, the types of the functions have to
be stored somewhere, in a TypeTuple
On Sunday, 12 August 2012 at 02:32:30 UTC, Timon Gehr wrote:
On 08/11/2012 11:42 PM, Henning Pohl wrote:
A struct takes a mixin template as argument:
struct S(alias Mixin) {
mixin Mixin;
}
How to specialize a mixin template like this one to pass to S?
mixin template MixinTemplate(T) {
}
S
So the struct is defined as:
struct S(T) {
}
template isS(T) {
// ...
}
static assert(isS(S!float));
static assert(!isS(float));
There may be some nasty ways using fullQualifiedName!T and so on
but I guess there is a better way, isn't it?
On Saturday, 11 August 2012 at 19:06:22 UTC, Chris Cain wrote:
Same idea, but doing it with just one template and using static
ifs...
struct S(T) {}
template isS(T) {
static if(is(T _ : S!U, U))
enum isS = true;
else
enum isS = false;
}
static assert(isS!(S!float));
A struct takes a mixin template as argument:
struct S(alias Mixin) {
mixin Mixin;
}
How to specialize a mixin template like this one to pass to S?
mixin template MixinTemplate(T) {
}
S(MixinTemplate!float); // Something like this