Add operator delete for SkTArray to match operator new
authorbsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Fri, 14 Jun 2013 12:30:50 +0000 (12:30 +0000)
committerbsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Fri, 14 Jun 2013 12:30:50 +0000 (12:30 +0000)
R=robertphillips@google.com

Review URL: https://codereview.chromium.org/17075002

git-svn-id: http://skia.googlecode.com/svn/trunk@9603 2bbb7eff-a529-9590-31e7-b0007b416f81

include/core/SkTArray.h

index 13c0d71..5e66ee0 100644 (file)
@@ -453,6 +453,13 @@ void* operator new(size_t, SkTArray<T, MEM_COPY>* array, int atIndex) {
     return array->push_back_raw(1);
 }
 
+// Skia doesn't use C++ exceptions but it may be compiled with them enabled. Having an op delete
+// to match the op new silences warnings about missing op delete when a constructor throws an
+// exception.
+template <typename T> void operator delete(void*, SkTArray<T, MEM_COPY>* array, int atIndex) {
+    SK_CRASH();
+}
+
 // Constructs a new object as the last element of an SkTArray.
 #define SkNEW_APPEND_TO_TARRAY(array_ptr, type_name, args)  \
     (new ((array_ptr), (array_ptr)->count()) type_name args)