WvStreams
Classes | Macros | Functions
delete.h File Reference
#include <new>
#include <memory>
#include <xplc/IObject.h>
Include dependency graph for delete.h:

Go to the source code of this file.

Classes

class  CheckIObject
 
class  CheckIObjectOk
 
class  CheckIObjectOkVector
 
class  ConversionIObject< T >
 
struct  ConversionIObject< T >::No
 
struct  XPLC_CTAssert< bool >
 
struct  XPLC_CTAssert< true >
 

Macros

#define xplcdelete   CheckIObjectOk() &&
 Undefine xplcdelete. More...
 
#define delete   CheckIObject() &&
 Overriding the delete keyword. More...
 
#define deletev   CheckIObjectOkVector() &&
 Remplacement for delete[]. More...
 

Functions

template<class T >
void operator&& (CheckIObject, const T *obj)
 
template<class T >
void operator&& (CheckIObjectOk, const T *obj)
 
template<class T >
void operator&& (CheckIObjectOkVector, const T *obj)
 

Detailed Description

Include this file right after IObject.h (or instead of) to detect accidental uses of "delete" on an XPLC interface. Use "xplcdelete" instead of "delete" when you know what you are doing.

Definition in file delete.h.

Macro Definition Documentation

◆ xplcdelete

#define xplcdelete   CheckIObjectOk() &&

Undefine xplcdelete.

<xplc/utils.h> defines xplcdelete, we should undo this, in case it has been included before. Macro used to indicate a valid use of the delete keyword with an XPLC interface. In some cases, you really need to use delete on an object that derives from IObject. In those cases, use "xplcdelete" instead of "delete".

Definition at line 114 of file delete.h.

◆ delete

#define delete   CheckIObject() &&

Overriding the delete keyword.

This replaces the delete keyword with an invocation of the operator&& using a specific marker class as the left operand, allowing it to be templated on the right operand.

Definition at line 122 of file delete.h.

◆ deletev

#define deletev   CheckIObjectOkVector() &&

Remplacement for delete[].

Because we cannot capture usage of delete[] using macros, we have to add a replacement for it, unfortunately.

Definition at line 129 of file delete.h.