Changeset a738c68 for libcfa/src


Ignore:
Timestamp:
Sep 14, 2023, 10:43:31 AM (15 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Children:
3df4cd9
Parents:
efe420f3
Message:

Update max/min so n-ary version doesn't match against the 2 argument case. Also added a test.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/common.hfa

    refe420f3 ra738c68  
    6969        T min( T v1, T v2 ) { return v1 < v2 ? v1 : v2; }
    7070
    71         forall( T, Ts... | { T min( T, T ); T min( T, Ts ); } )
    72         T min( T v1, T v2, Ts vs ) { return min( min( v1, v2 ), vs ); }
     71        forall( T, Ts... | { T min( T, T ); T min( T, T, Ts ); } )
     72        T min( T v1, T v2, T v3, Ts vs ) { return min( min( v1, v2 ), v3, vs ); }
    7373
    7474        forall( T | { int ?>?( T, T ); } )
    7575        T max( T v1, T v2 ) { return v1 > v2 ? v1 : v2; }
    7676
    77         forall( T, Ts... | { T max( T, T ); T max( T, Ts ); } )
    78         T max( T v1, T v2, Ts vs ) { return max( max( v1, v2 ), vs ); }
     77        forall( T, Ts... | { T max( T, T ); T max( T, T, Ts ); } )
     78        T max( T v1, T v2, T v3, Ts vs ) { return max( max( v1, v2 ), v3, vs ); }
    7979
    8080        forall( T | { T min( T, T ); T max( T, T ); } )
Note: See TracChangeset for help on using the changeset viewer.