Last change
on this file since 6394ac6 was
55b060d,
checked in by Peter A. Buhr <pabuhr@…>, 12 months ago
|
rename directories containers to collections
|
-
Property mode set to
100644
|
File size:
1.2 KB
|
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 24 14:43:00 2017 |
---|
11 | // Last Modified By : Peter A. Buhr |
---|
12 | // Last Modified On : Sat Jul 22 10:00:52 2017 |
---|
13 | // Update Count : 4 |
---|
14 | // |
---|
15 | |
---|
16 | #pragma once |
---|
17 | |
---|
18 | #include <stdbool.h> |
---|
19 | |
---|
20 | // DO NOT USE DIRECTLY! |
---|
21 | forall(T) |
---|
22 | struct maybe { |
---|
23 | bool has_value; |
---|
24 | T value; |
---|
25 | }; |
---|
26 | |
---|
27 | |
---|
28 | forall(T) |
---|
29 | void ?{}(maybe(T) & this); |
---|
30 | |
---|
31 | forall(T) |
---|
32 | void ?{}(maybe(T) & this, T value); |
---|
33 | |
---|
34 | forall(T) |
---|
35 | void ?{}(maybe(T) & this, maybe(T) other); |
---|
36 | |
---|
37 | forall(T) |
---|
38 | void ^?{}(maybe(T) & this); |
---|
39 | |
---|
40 | forall(T) |
---|
41 | maybe(T) ?=?(maybe(T) & this, maybe(T) other); |
---|
42 | |
---|
43 | forall(T) |
---|
44 | bool ?!=?(maybe(T) this, zero_t); |
---|
45 | |
---|
46 | /* Waiting for bug#11 to be fixed. |
---|
47 | forall(T) |
---|
48 | maybe(T) maybe_value(T value); |
---|
49 | |
---|
50 | forall(T) |
---|
51 | maybe(T) maybe_none(); |
---|
52 | */ |
---|
53 | |
---|
54 | forall(T) |
---|
55 | bool has_value(maybe(T) * this); |
---|
56 | |
---|
57 | forall(T) |
---|
58 | T get(maybe(T) * this); |
---|
59 | |
---|
60 | forall(T) |
---|
61 | void set(maybe(T) * this, T value); |
---|
62 | |
---|
63 | forall(T) |
---|
64 | void set_none(maybe(T) * this); |
---|
65 | |
---|
66 | // Local Variables: // |
---|
67 | // mode: c // |
---|
68 | // tab-width: 4 // |
---|
69 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.