Hi Martin,

a happy new year to you, too! I've just committed the fixes -- thanks again for your patch(es)!


--
Kind regards / Mit freundlichen Grüßen

******************************************************************
Andreas Löffler | VirtualBox Engineering
Principal Software Engineer | Oracle Virtualization

Oracle Global Services Germany GmbH
Riesstr. 25, D-80992 München
Registergericht: Amtsgericht München, HRB 246209
Geschäftsführer: Ralf Herrmann

Green Oracle <http://www.oracle.com/commitment> <http://www.oracle.com/commitment%3e>; Oracle is committed to developing practices and products that help protect the environment




On 28.12.22 15:04, Martin Fleisz via vbox-dev wrote:
The patch below fixes a compilation issue when using vector::data() and
adds a clear() method to the template.

I'm submitting this patch under the MIT license.

Best regards and a happy new year!

Martin Fleisz
Thincast Technologies GmbH
Bahnhofplatz 7/3, 2340 Moedling, Austria
http://www.thincast.com


diff --git include/iprt/nocrt/vector include/iprt/nocrt/vector
index 925f9e1ac18..e5ed2c4f4ce 100644
--- include/iprt/nocrt/vector
+++ include/iprt/nocrt/vector
@@ -228,15 +228,7 @@ namespace std
         ~vector()
          {
-            size_type i = m_cItems;
-            while (i-- > 0)
-            {
-                m_Allocator.destroy(&m_paItems[i]);
-                m_cItems = i;
-            }
-            m_Allocator.deallocate(m_paItems, m_cAllocated);
-            m_paItems    = NULL;
-            m_cAllocated = 0;
+            clear();
          }
@@ -309,12 +301,12 @@ namespace std          pointer data() RT_NOEXCEPT
          {
-            return m_paItem;
+            return m_paItems;
          }
         const_pointer data() const RT_NOEXCEPT
          {
-            return m_paItem;
+            return m_paItems;
          }
         /** @}  */
@@ -385,6 +377,19 @@ namespace std
              if (m_cItems > 0)
                  m_cItems -= 1;
          }
+
+        void clear() RT_NOEXCEPT
+        {
+            size_type i = m_cItems;
+            while (i-- > 0)
+            {
+                m_Allocator.destroy(&m_paItems[i]);
+                m_cItems = i;
+            }
+            m_Allocator.deallocate(m_paItems, m_cAllocated);
+            m_paItems = NULL;
+            m_cAllocated = 0;
+        }
          /** @} */
     };

_______________________________________________
vbox-dev mailing list
vbox-dev@virtualbox.org
https://www.virtualbox.org/mailman/listinfo/vbox-dev

Attachment: OpenPGP_0x46BCB4E5EE437BAD.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

_______________________________________________
vbox-dev mailing list
vbox-dev@virtualbox.org
https://www.virtualbox.org/mailman/listinfo/vbox-dev

Reply via email to