Nvwa  1.1
Public Member Functions | Private Member Functions | List of all members
nvwa::debug_new_recorder Class Reference

Recorder class to remember the call context. More...

#include <debug_new.h>

Public Member Functions

 debug_new_recorder (const char *file, int line)
 Constructor to remember the call context. More...
 
template<class _Tp >
_Tp * operator->* (_Tp *ptr)
 Operator to write the context information to memory. More...
 

Private Member Functions

void _M_process (void *ptr)
 Processes the allocated memory and inserts file/line informatin. More...
 

Detailed Description

Recorder class to remember the call context.

The idea comes from Greg Herlihy's post in comp.lang.c++.moderated.

Constructor & Destructor Documentation

◆ debug_new_recorder()

nvwa::debug_new_recorder::debug_new_recorder ( const char *  file,
int  line 
)
inline

Constructor to remember the call context.

The information will be used in debug_new_recorder::operator->*.

Member Function Documentation

◆ _M_process()

void nvwa::debug_new_recorder::_M_process ( void *  usr_ptr)
private

Processes the allocated memory and inserts file/line informatin.

It will only be done when it can ensure the memory is allocated by one of our operator new variants.

Parameters
usr_ptrpointer returned by a new-expression

◆ operator->*()

template<class _Tp >
_Tp* nvwa::debug_new_recorder::operator->* ( _Tp *  ptr)
inline

Operator to write the context information to memory.

operator->* is chosen because it has the right precedence, it is rarely used, and it looks good: so people can tell the special usage more quickly.


The documentation for this class was generated from the following files: