// // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo // // The contents of this file are covered under the licence agreement in the // file "LICENCE" distributed with Cforall. // // maybe -- May contain a value. // // Author : Andrew Beach // Created On : Wed May 25 14:43:00 2017 // Last Modified By : Andrew Beach // Last Modified On : Wed Apr 25 16:58:00 2017 // Update Count : 1 // #ifndef MAYBE_H #define MAYBE_H // DO NOT USE DIRECTLY! forall(otype T) struct maybe { _Bool has_value; T value; }; forall(otype T) void ?{}(maybe(T) * this); forall(otype T) void ?{}(maybe(T) * this, T value); forall(otype T) void ?{}(maybe(T) * this, maybe(T) other); forall(otype T) void ^?{}(maybe(T) * this); forall(otype T) _Bool ?!=?(result(T, E) this, zero_t); forall(otype T) maybe(T) maybe_value(T value); forall(otype T) maybe(T) maybe_none(); forall(otype T) _Bool has_value(maybe(T) * this); forall(otype T) T get(maybe(T) * this); #endif // MAYBE_H