12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- #ifndef IGL_SORTABLE_ROW_H
- #define IGL_SORTABLE_ROW_H
- #include <Eigen/Core>
- namespace igl
- {
-
-
- template <typename T>
- class SortableRow
- {
- public:
- T data;
- public:
- SortableRow():data(){};
- SortableRow(const T & data):data(data){};
- bool operator<(const SortableRow & that) const
- {
-
- const SortableRow<T> & THIS = *this;
-
- int minc = (THIS.data.size() < that.data.size()?
- THIS.data.size() : that.data.size());
-
- for(int i = 0;i<minc;i++)
- {
- if(THIS.data(i) == that.data(i))
- {
- continue;
- }
- return THIS.data(i) < that.data(i);
- }
-
- return THIS.data.size()<that.data.size();
- };
- bool operator==(const SortableRow & that) const
- {
-
- const SortableRow<T> & THIS = *this;
- if(THIS.data.size() != that.data.size())
- {
- return false;
- }
- for(int i = 0;i<THIS.data.size();i++)
- {
- if(THIS.data(i) != that.data(i))
- {
- return false;
- }
- }
- return true;
- };
- bool operator!=(const SortableRow & that) const
- {
- return !(*this == that);
- };
- };
- }
- #endif
|