@@ -57,10 +57,10 @@ template<class T, class Less = DefaultLess> struct OrderedSetOf {
5757 [[nodiscard]] operator Slice () const noexcept { return Slice{begin (), m_count}; }
5858
5959 void ensureCapacity (Count count) {
60- if (totalCapacity () < count) growBy (count - totalCapacity ());
60+ if (totalCapacity () < count) growBy (static_cast < size_t >( count - totalCapacity () ));
6161 }
6262 void ensureUnusedCapacity (Count count) {
63- if (unusedCapacity () < count) growBy (count);
63+ if (unusedCapacity () < count) growBy (static_cast < size_t >( count - unusedCapacity ()) );
6464 }
6565
6666 // / inserts a single value to the set if it is not yet present
@@ -90,7 +90,7 @@ template<class T, class Less = DefaultLess> struct OrderedSetOf {
9090 return true ;
9191 }
9292 if (it != end ()) {
93- memmove (it + 1 , it, end () - it);
93+ memmove (it + 1 , it, static_cast < size_t >( end () - it) );
9494 }
9595 *it = v;
9696 m_count++;
@@ -103,7 +103,7 @@ template<class T, class Less = DefaultLess> struct OrderedSetOf {
103103 void remove (ConstIterator cIt) {
104104 auto it = const_cast <Iterator>(cIt);
105105 if (it + 1 != end ()) {
106- memmove (it, it + 1 , end () - it - 1 );
106+ memmove (it, it + 1 , static_cast < size_t >( end () - it - 1 ) );
107107 }
108108 m_count--;
109109 }
@@ -210,15 +210,15 @@ template<class T, class Less = DefaultLess> struct OrderedSetOf {
210210 }
211211
212212private:
213- [[nodiscard]] auto grownStorage (int growBy) const -> AmendableSlice {
213+ [[nodiscard]] auto grownStorage (size_t growBy) const -> AmendableSlice {
214214 auto cur = m_capacity;
215215 auto res = (cur << 1 ) - (cur >> 1 ) + (cur >> 4 ); // * 1.563
216216 if (res < 5 ) res = 5 ;
217217 if (res < m_capacity + growBy) res = m_capacity + growBy;
218218 auto ptr = Utils::allocate (res);
219219 return AmendableSlice{ptr, res};
220220 }
221- void growBy (int by) {
221+ void growBy (size_t by) {
222222 auto newStorage = grownStorage (by);
223223 memcpy (newStorage.begin (), m_pointer, m_count);
224224 Utils::deallocate (SliceOf{m_pointer, m_capacity});
0 commit comments