ADT
arm-eh
ast-experimental
enum
forall-pointer-decay
jacob/cs343-translation
new-ast
new-ast-unique-expr
pthread-emulation
qualifiedEnum
Last change
on this file since 7215000 was bf71cfd, checked in by Thierry Delisle <tdelisle@…>, 7 years ago |
Moved up many directories in source
|
-
Property mode
set to
100644
|
File size:
448 bytes
|
Rev | Line | |
---|
[273080f] | 1 | forall(otype T)
|
---|
| 2 | struct wrapper
|
---|
| 3 | {
|
---|
| 4 | T val;
|
---|
| 5 | };
|
---|
| 6 |
|
---|
| 7 | forall(otype T)
|
---|
| 8 | void ctor(wrapper(T)* this)
|
---|
| 9 | {
|
---|
| 10 | this->val = 0;
|
---|
| 11 | }
|
---|
| 12 |
|
---|
| 13 | forall(otype T)
|
---|
| 14 | wrapper(T) gcmalloc()
|
---|
| 15 | {
|
---|
| 16 | wrapper(T) w;
|
---|
| 17 | ctor(&w);
|
---|
| 18 | return w;
|
---|
| 19 | }
|
---|
| 20 |
|
---|
| 21 | forall(otype T)
|
---|
| 22 | wrapper(T)* ?=? (wrapper(T)* lhs, wrapper(T)* rhs)
|
---|
| 23 | {
|
---|
| 24 | lhs->val = rhs->val;
|
---|
| 25 | return lhs;
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | int main(int argc, char *argv[])
|
---|
| 29 | {
|
---|
| 30 | wrapper(int) test;
|
---|
| 31 | test = gcmalloc();
|
---|
| 32 | return 0;
|
---|
| 33 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.