source: src/libcfa/containers/maybe@ 8dc51c8

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 8dc51c8 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
RevLine 
[79308c8e]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.