Changeset 244


Ignore:
Timestamp:
Jan 20, 2011, 1:02:45 AM (10 years ago)
Author:
sam
Message:

Implement vector equality comparisons.

Location:
trunk/src
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/matrix.h

    r242 r244  
    2929    }
    3030
     31#define BOOL_OP(elems, op, ret) \
     32    inline bool operator op(Vec##elems<T> const &val) const \
     33    { \
     34        for (int n = 0; n < elems; n++) \
     35            if ((*this)[n] != val[n]) \
     36                return ret; \
     37        return !ret; \
     38    }
     39
    3140#define SCALAR_OP(elems, op) \
    3241    inline Vec##elems<T> operator op(T const &val) const \
     
    4655    VECTOR_OP(elems, *) \
    4756    VECTOR_OP(elems, /) \
     57    \
     58    BOOL_OP(elems, ==, false) \
     59    BOOL_OP(elems, !=, true) \
    4860    \
    4961    SCALAR_OP(elems, -) \
Note: See TracChangeset for help on using the changeset viewer.