Changeset 73d0e3f4 for libcfa


Ignore:
Timestamp:
Jun 29, 2024, 5:22:36 PM (5 months ago)
Author:
JiadaL <j82liang@…>
Branches:
master
Children:
011c29e
Parents:
115ac1ce
Message:

Current enum has bug when use as a reference as in ?++. Change TranslateEnumRange? to use succ and pred instead. Will look back into the reference problem

Location:
libcfa/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/enum.cfa

    r115ac1ce r73d0e3f4  
    2323    int ?>?(E l, E r) { return posn(l) > posn(r); }
    2424    int ?>=?(E l, E r) { return posn(l) >= posn(r); }
     25
     26    E ++?(E& l) {
     27        l = succ(l);
     28        return l;
     29    }
     30   
     31    E ?++(E& l) {
     32        E ret = l;
     33        l = succ(l);
     34        return ret;
     35    }
     36
     37    E --?(E& l) {
     38        l = pred(l);
     39        return l;
     40    }
     41
     42    E ?--(E& l) {
     43        E ret = l;
     44        l = pred(l);
     45        return ret;
     46    }
    2547}
  • libcfa/src/enum.hfa

    r115ac1ce r73d0e3f4  
    4949    int ?>?(E, E);
    5050    int ?>=?(E, E);
     51
     52    int ++?(E&);
     53    int ?++(E&);
     54    int --?(E&);
     55    int ?--(E&);
    5156}
Note: See TracChangeset for help on using the changeset viewer.