ADTast-experimental
Last change
on this file since 5adf4f4 was
8a97248,
checked in by Peter A. Buhr <pabuhr@…>, 19 months ago
|
switch from old trait syntax to new trait syntax using forall clause
|
-
Property mode set to
100644
|
File size:
1.4 KB
|
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 | // 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 |
---|
12 | // Last Modified On : Thu Feb 2 11:36:56 2023 |
---|
13 | // Update Count : 20 |
---|
14 | // |
---|
15 | |
---|
16 | #pragma once |
---|
17 | |
---|
18 | forall( U ) |
---|
19 | trait Not { |
---|
20 | void ?{}( U &, zero_t ); |
---|
21 | int !?( U ); |
---|
22 | }; // Not |
---|
23 | |
---|
24 | forall( T | Not( T ) ) |
---|
25 | trait Equality { |
---|
26 | int ?==?( T, T ); |
---|
27 | int ?!=?( T, T ); |
---|
28 | }; // Equality |
---|
29 | |
---|
30 | forall( U | Equality( U ) ) |
---|
31 | trait Relational { |
---|
32 | int ?<?( U, U ); |
---|
33 | int ?<=?( U, U ); |
---|
34 | int ?>?( U, U ); |
---|
35 | int ?>=?( U, U ); |
---|
36 | }; // Relational |
---|
37 | |
---|
38 | forall ( T ) |
---|
39 | trait Signed { |
---|
40 | T +?( T ); |
---|
41 | T -?( T ); |
---|
42 | T abs( T ); |
---|
43 | }; // Signed |
---|
44 | |
---|
45 | forall( U | Signed( U ) ) |
---|
46 | trait Additive { |
---|
47 | U ?+?( U, U ); |
---|
48 | U ?-?( U, U ); |
---|
49 | U ?+=?( U &, U ); |
---|
50 | U ?-=?( U &, U ); |
---|
51 | }; // Additive |
---|
52 | |
---|
53 | forall( T | Additive( T ) ) |
---|
54 | trait Incdec { |
---|
55 | void ?{}( T &, one_t ); |
---|
56 | // T ?++( T & ); |
---|
57 | // T ++?( T & ); |
---|
58 | // T ?--( T & ); |
---|
59 | // T --?( T & ); |
---|
60 | }; // Incdec |
---|
61 | |
---|
62 | forall( U | Incdec( U ) ) |
---|
63 | trait Multiplicative { |
---|
64 | U ?*?( U, U ); |
---|
65 | U ?/?( U, U ); |
---|
66 | U ?%?( U, U ); |
---|
67 | U ?/=?( U &, U ); |
---|
68 | }; // Multiplicative |
---|
69 | |
---|
70 | forall( T | Relational( T ) | Multiplicative( T ) ) |
---|
71 | trait Arithmetic { |
---|
72 | }; // Arithmetic |
---|
73 | |
---|
74 | // Local Variables: // |
---|
75 | // mode: c // |
---|
76 | // tab-width: 4 // |
---|
77 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.