source: libcfa/src/math.trait.hfa @ 5c216b4

ADTast-experimentalenumpthread-emulationqualifiedEnum
Last change on this file since 5c216b4 was 08bc3e7, checked in by Peter A. Buhr <pabuhr@…>, 3 years ago

first draft of math trait

  • Property mode set to 100644
File size: 1.3 KB
RevLine 
[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
12// Last Modified On : Tue Jul 20 17:47:19 2021
13// Update Count     : 19
14//
15
16#pragma once
17
18trait Not( T ) {
19        void ?{}( T &, zero_t );
20        int !?( T );
21}; // Not
22
23trait Equality( T | Not( T ) ) {
24        int ?==?( T, T );
25        int ?!=?( T, T );
26}; // Equality
27
28trait Relational( T | Equality( T ) ) {
29        int ?<?( T, T );
30        int ?<=?( T, T );
31        int ?>?( T, T );
32        int ?>=?( T, T );
33}; // Relational
34
35trait Signed( T ) {
36        T +?( T );
37        T -?( T );
38        T abs( T );
39}; // Signed
40
41trait Additive( T | Signed( T ) ) {
42        T ?+?( T, T );
43        T ?-?( T, T );
44        T ?+=?( T &, T );
45        T ?-=?( T &, T );
46}; // Additive
47
48trait Incdec( T | Additive( T ) ) {
49        void ?{}( T &, one_t );
50        // T ?++( T & );
51        // T ++?( T &);
52        // T ?--( T & );
53        // T --?( T & );
54}; // Incdec
55
56trait Multiplicative( T | Incdec( T ) ) {
57        T ?*?( T, T );
58        T ?/?( T, T );
59        T ?%?( T, T );
60        T ?/=?( T &, T );
61}; // Multiplicative
62
63trait Arithmetic( T | Relational( T ) | Multiplicative( T ) ) {
64}; // Arithmetic
65
66// Local Variables: //
67// mode: c //
68// tab-width: 4 //
69// End: //
Note: See TracBrowser for help on using the repository browser.