Changes in src/libcfa/containers/maybe.c [aca65621:58daf53]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/containers/maybe.c
raca65621 r58daf53 19 19 20 20 forall(otype T) 21 void ?{}(maybe(T) &this) {22 this .has_value = false;21 void ?{}(maybe(T) * this) { 22 this->has_value = false; 23 23 } 24 24 25 25 forall(otype T) 26 void ?{}(maybe(T) &this, T value) {27 this .has_value = true;28 ( this.value){value};26 void ?{}(maybe(T) * this, T value) { 27 this->has_value = true; 28 (&this->value){value}; 29 29 } 30 30 31 31 forall(otype T) 32 void ?{}(maybe(T) &this, maybe(T) other) {33 this .has_value = other.has_value;32 void ?{}(maybe(T) * this, maybe(T) other) { 33 this->has_value = other.has_value; 34 34 if (other.has_value) { 35 ( this.value){other.value};35 (&this->value){other.value}; 36 36 } 37 37 } 38 38 39 39 forall(otype T) 40 maybe(T) ?=?(maybe(T) &this, maybe(T) that) {41 if (this .has_value & that.has_value) {42 this .value = that.value;43 } else if (this .has_value) {44 ^( this.value){};45 this .has_value = false;40 maybe(T) ?=?(maybe(T) * this, maybe(T) that) { 41 if (this->has_value & that.has_value) { 42 this->value = that.value; 43 } else if (this->has_value) { 44 ^(&this->value){}; 45 this->has_value = false; 46 46 } else if (that.has_value) { 47 this .has_value = true;48 ( this.value){that.value};47 this->has_value = true; 48 (&this->value){that.value}; 49 49 } 50 return this;51 50 } 52 51 53 52 forall(otype T) 54 void ^?{}(maybe(T) &this) {55 if (this .has_value) {56 ^( this.value){};53 void ^?{}(maybe(T) * this) { 54 if (this->has_value) { 55 ^(&this->value){}; 57 56 } 58 57 } … … 90 89 } else { 91 90 this->has_value = true; 92 ( this->value){value};91 (&this->value){value}; 93 92 } 94 93 } … … 98 97 if (this->has_value) { 99 98 this->has_value = false; 100 ^( this->value){};99 ^(&this->value){}; 101 100 } 102 101 }
Note:
See TracChangeset
for help on using the changeset viewer.