Last change
on this file since 9b140bd was
6a93e4d,
checked in by Peter A. Buhr <pabuhr@…>, 17 months ago
|
make trait names not, equality, relational, additive, inc_dec, multiplicative, arithmetic, lower-case
|
-
Property mode set to
100644
|
File size:
1.4 KB
|
Rev | Line | |
---|
[08bc3e7] | 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 | // math.trait.hfa -- |
---|
| 8 | // |
---|
| 9 | // Author : Peter A. Buhr |
---|
| 10 | // Created On : Fri Jul 16 15:40:52 2021 |
---|
| 11 | // Last Modified By : Peter A. Buhr |
---|
[6a93e4d] | 12 | // Last Modified On : Tue Jun 6 07:59:17 2023 |
---|
| 13 | // Update Count : 24 |
---|
[08bc3e7] | 14 | // |
---|
| 15 | |
---|
| 16 | #pragma once |
---|
| 17 | |
---|
[8a97248] | 18 | forall( U ) |
---|
[6a93e4d] | 19 | trait not { |
---|
[7d7ef6f] | 20 | void ?{}( U &, zero_t ); |
---|
| 21 | int !?( U ); |
---|
[6a93e4d] | 22 | }; // not |
---|
[08bc3e7] | 23 | |
---|
[6a93e4d] | 24 | forall( T | not( T ) ) |
---|
| 25 | trait equality { |
---|
[08bc3e7] | 26 | int ?==?( T, T ); |
---|
| 27 | int ?!=?( T, T ); |
---|
[6a93e4d] | 28 | }; // equality |
---|
[08bc3e7] | 29 | |
---|
[6a93e4d] | 30 | forall( U | equality( U ) ) |
---|
| 31 | trait relational { |
---|
[7d7ef6f] | 32 | int ?<?( U, U ); |
---|
| 33 | int ?<=?( U, U ); |
---|
| 34 | int ?>?( U, U ); |
---|
| 35 | int ?>=?( U, U ); |
---|
[6a93e4d] | 36 | }; // relational |
---|
[08bc3e7] | 37 | |
---|
[8a97248] | 38 | forall ( T ) |
---|
[6a93e4d] | 39 | trait Signed { // must be capitalized, conflict with keyword signed |
---|
[08bc3e7] | 40 | T +?( T ); |
---|
| 41 | T -?( T ); |
---|
| 42 | T abs( T ); |
---|
| 43 | }; // Signed |
---|
| 44 | |
---|
[8a97248] | 45 | forall( U | Signed( U ) ) |
---|
[6a93e4d] | 46 | trait additive { |
---|
[7d7ef6f] | 47 | U ?+?( U, U ); |
---|
| 48 | U ?-?( U, U ); |
---|
| 49 | U ?+=?( U &, U ); |
---|
| 50 | U ?-=?( U &, U ); |
---|
[6a93e4d] | 51 | }; // additive |
---|
[08bc3e7] | 52 | |
---|
[6a93e4d] | 53 | forall( T | additive( T ) ) |
---|
| 54 | trait inc_dec { |
---|
[08bc3e7] | 55 | void ?{}( T &, one_t ); |
---|
| 56 | // T ?++( T & ); |
---|
[7d7ef6f] | 57 | // T ++?( T & ); |
---|
[08bc3e7] | 58 | // T ?--( T & ); |
---|
| 59 | // T --?( T & ); |
---|
[6a93e4d] | 60 | }; // inc_dec |
---|
[08bc3e7] | 61 | |
---|
[6a93e4d] | 62 | forall( U | inc_dec( U ) ) |
---|
| 63 | trait multiplicative { |
---|
[7d7ef6f] | 64 | U ?*?( U, U ); |
---|
| 65 | U ?/?( U, U ); |
---|
| 66 | U ?%?( U, U ); |
---|
| 67 | U ?/=?( U &, U ); |
---|
[6a93e4d] | 68 | }; // multiplicative |
---|
[08bc3e7] | 69 | |
---|
[6a93e4d] | 70 | forall( T | relational( T ) | multiplicative( T ) ) |
---|
| 71 | trait arithmetic { |
---|
| 72 | }; // arithmetic |
---|
[08bc3e7] | 73 | |
---|
| 74 | // Local Variables: // |
---|
| 75 | // mode: c // |
---|
| 76 | // tab-width: 4 // |
---|
| 77 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.