source: src/libcfa/containers/maybe @ bc37a83

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since bc37a83 was 79308c8e, checked in by Andrew Beach <ajbeach@…>, 7 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!
22forall(otype T)
23struct maybe {
24    _Bool has_value;
25    T value;
26};
27
28
29forall(otype T)
30void ?{}(maybe(T) * this);
31
32forall(otype T)
33void ?{}(maybe(T) * this, T value);
34
35forall(otype T)
36void ?{}(maybe(T) * this, maybe(T) other);
37
38forall(otype T)
39void ^?{}(maybe(T) * this);
40
41forall(otype T)
42_Bool ?!=?(result(T, E) this, zero_t);
43
44forall(otype T)
45maybe(T) maybe_value(T value);
46
47forall(otype T)
48maybe(T) maybe_none();
49
50forall(otype T)
51_Bool has_value(maybe(T) * this);
52
53forall(otype T)
54T get(maybe(T) * this);
55
56#endif // MAYBE_H
Note: See TracBrowser for help on using the repository browser.