ADT
aaron-thesis
arm-eh
ast-experimental
cleanup-dtors
deferred_resn
demangler
enum
forall-pointer-decay
jacob/cs343-translation
jenkins-sandbox
new-ast
new-ast-unique-expr
new-env
no_list
persistent-indexer
pthread-emulation
qualifiedEnum
resolv-new
with_gc
|
Last change
on this file since 79308c8e was 79308c8e, checked in by Andrew Beach <ajbeach@…>, 8 years ago |
|
First draft of maybe and result.
|
-
Property mode
set to
100644
|
|
File size:
1009 bytes
|
| Line | |
|---|
| 1 | //
|
|---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
|
|---|
| 3 | //
|
|---|
| 4 | // The contents of this file are covered under the licence agreement in the
|
|---|
| 5 | // file "LICENCE" distributed with Cforall.
|
|---|
| 6 | //
|
|---|
| 7 | // maybe -- May contain a value.
|
|---|
| 8 | //
|
|---|
| 9 | // Author : Andrew Beach
|
|---|
| 10 | // Created On : Wed May 25 14:43:00 2017
|
|---|
| 11 | // Last Modified By : Andrew Beach
|
|---|
| 12 | // Last Modified On : Wed Apr 25 16:58:00 2017
|
|---|
| 13 | // Update Count : 1
|
|---|
| 14 | //
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 | #ifndef MAYBE_H
|
|---|
| 18 | #define MAYBE_H
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 | // DO NOT USE DIRECTLY!
|
|---|
| 22 | forall(otype T)
|
|---|
| 23 | struct maybe {
|
|---|
| 24 | _Bool has_value;
|
|---|
| 25 | T value;
|
|---|
| 26 | };
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 | forall(otype T)
|
|---|
| 30 | void ?{}(maybe(T) * this);
|
|---|
| 31 |
|
|---|
| 32 | forall(otype T)
|
|---|
| 33 | void ?{}(maybe(T) * this, T value);
|
|---|
| 34 |
|
|---|
| 35 | forall(otype T)
|
|---|
| 36 | void ?{}(maybe(T) * this, maybe(T) other);
|
|---|
| 37 |
|
|---|
| 38 | forall(otype T)
|
|---|
| 39 | void ^?{}(maybe(T) * this);
|
|---|
| 40 |
|
|---|
| 41 | forall(otype T)
|
|---|
| 42 | _Bool ?!=?(result(T, E) this, zero_t);
|
|---|
| 43 |
|
|---|
| 44 | forall(otype T)
|
|---|
| 45 | maybe(T) maybe_value(T value);
|
|---|
| 46 |
|
|---|
| 47 | forall(otype T)
|
|---|
| 48 | maybe(T) maybe_none();
|
|---|
| 49 |
|
|---|
| 50 | forall(otype T)
|
|---|
| 51 | _Bool has_value(maybe(T) * this);
|
|---|
| 52 |
|
|---|
| 53 | forall(otype T)
|
|---|
| 54 | T get(maybe(T) * this);
|
|---|
| 55 |
|
|---|
| 56 | #endif // MAYBE_H
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.