From 2c9639f77795742fd2714adbb3ed273d61ae924d Mon Sep 17 00:00:00 2001 From: Jens Maurer Date: Wed, 9 May 2001 17:38:30 +0000 Subject: [PATCH] delete const pointer [SVN r10078] --- microsoft_vcpp.html | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/microsoft_vcpp.html b/microsoft_vcpp.html index bfde08d..7f7acbb 100644 --- a/microsoft_vcpp.html +++ b/microsoft_vcpp.html @@ -267,8 +267,30 @@ types, as is required by the standard, and so ambiguities may emanate when overloading on wchar_t. The macro BOOST_NO_INTRINSIC_WCHAR_T is defined in this situation. -

-Standard Library

+ +

[delete-const-pointer] Deleting const X * does not work

+ +Trying to delete a pointer to a cv-qualified type gives an error: +
+void f()
+{
+  const int *p = new int(5);
+  delete p;        // C2664: cannot convert from "const int *" to "void *"
+}
+
+ +Workaround: Define the function +
+inline void operator delete(const void *p) throw()
+{ operator delete(const_cast<void*>(p)); }
+
+and similar functions for the other cv-qualifier combinations, for +operator delete[], and for the std::nothrow variants. + + + +

Standard Library

+

[clib-namespace] C library names in global namespace instead of std

Library names from the <c...> headers are in the global namespace instead of namespace std.

Workaround:  The header boost/config.hpp