compile-time function in a class?
Davidl
Davidl at 126.com
Tue Mar 20 19:28:58 PDT 2007
class test
{
template c(){ static char[] c(){return "int k;";}}
int a;
class b
{
mixin(c());
}
}
void main()
{
}
above is a great work around for me, i get name space protect my compile
time func,
thx for ur hint of what actually compile-time func could be
> Davidl wrote:
>> class test
>> {
>> static char[] c(){return "a";}
>> int a;
>> class b
>> {
>> mixin(c());
>> }
>> }
>> void main()
>> {
>> }
>> don't u think my example should compile?
>> i don't violate any thing from evaluating func c from compile-time
>
> AFAIK, to be able to mixin a function, it has to be either inside a
> template, a templated struct, a templated class or just be a template
> function.
More information about the Digitalmars-d
mailing list