define a separate index type so as not to have any confusion between ints and indices
| 20 | // define a separate index type so as not to have |
| 21 | // any confusion between ints and indices |
| 22 | struct StringTableIndex |
| 23 | { |
| 24 | public: |
| 25 | typedef uint32_t index_type; |
| 26 | |
| 27 | // the default constructor was a private member before to prevent |
| 28 | // the empty instantiation. But, it became public now to resolve |
| 29 | // a linking error on windows platform. PyImathStringArray is |
| 30 | // exposed with PYIMATH_EXPORT, This causes to expose all the members |
| 31 | // of PyImathFixedArray<StringTableIndex> also. |
| 32 | |
| 33 | StringTableIndex() : _index(0) {} |
| 34 | StringTableIndex (const StringTableIndex &si) : _index (si._index) {} |
| 35 | explicit StringTableIndex (index_type i) : _index (i) {} |
| 36 | ~StringTableIndex() = default; |
| 37 | |
| 38 | const StringTableIndex & operator = (const StringTableIndex &si) |
| 39 | { |
| 40 | if (&si != this) |
| 41 | _index = si._index; |
| 42 | |
| 43 | return *this; |
| 44 | } |
| 45 | |
| 46 | bool operator == (const StringTableIndex &si) const |
| 47 | { |
| 48 | return _index == si._index; |
| 49 | } |
| 50 | |
| 51 | bool operator != (const StringTableIndex &si) const |
| 52 | { |
| 53 | return _index != si._index; |
| 54 | } |
| 55 | |
| 56 | // operator less for sorting |
| 57 | bool operator < (const StringTableIndex &si) const |
| 58 | { |
| 59 | return _index < si._index; |
| 60 | } |
| 61 | |
| 62 | index_type index() const { return _index; } |
| 63 | |
| 64 | private: |
| 65 | index_type _index; |
| 66 | }; |
| 67 | |
| 68 | } // namespace PyImath |
| 69 |
no outgoing calls