Mercurial > projects > dstress
changeset 337:5c636c0543fe
forward referenced mixin
Ben Hinkle
2005-03-18
news:d1faqu$1pir$1@digitaldaemon.com
nntp://news.digitalmars.com/digitalmars.D.announce/10
author | thomask |
---|---|
date | Sun, 20 Mar 2005 07:26:58 +0000 |
parents | e3562def9b09 |
children | 1f6cf5ccfbc9 |
files | run/mixin_07.d run/mixin_08.d |
diffstat | 2 files changed, 54 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/mixin_07.d Sun Mar 20 07:26:58 2005 +0000 @@ -0,0 +1,27 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Ben Hinkle +// @date@ 2005-03-18 +// @uri@ news:d1faqu$1pir$1@digitaldaemon.com +// @url@ nntp://news.digitalmars.com/digitalmars.D.announce/10 + +module dstress.run.mixin_07; + +template Foo(alias tail) { + int test(){ + return 1; + } +} + +struct List(V) { + mixin Foo!(tail); + V tail; +} + +int main(){ + List!(int) x; + assert(x.test()==1); + return 0; +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/mixin_08.d Sun Mar 20 07:26:58 2005 +0000 @@ -0,0 +1,27 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ Ben Hinkle +// @date@ 2005-03-18 +// @uri@ news:d1faqu$1pir$1@digitaldaemon.com +// @url@ nntp://news.digitalmars.com/digitalmars.D.announce/10 + +module dstress.run.mixin_08; + +template Foo(alias tail) { + int test(){ + return 1; + } +} + +struct List(V) { + V tail; + mixin Foo!(tail); +} + +int main(){ + List!(int) x; + assert(x.test()==1); + return 0; +} \ No newline at end of file