DefinesPtrs.h File Reference
`#include <memory>`
Include dependency graph for DefinesPtrs.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Macros

#define | LOMIRI_DEFINES_PTRS(classname)
| Macro to add smart pointer definitions to a class. More...

## Macro Definition Documentation

## LOMIRI_DEFINES_PTRS

#define LOMIRI_DEFINES_PTRS | ( |  | classname | ) |

Value:
typedef std::shared_ptr<classname> SPtr; \
typedef std::shared_ptr<classname const> SCPtr; \
typedef std::unique_ptr<classname> UPtr; \
typedef std::unique_ptr<classname const> UCPtr

Macro to add smart pointer definitions to a class.

This macro injects type definitions for smart pointer types into a class. It is useful to establish a common naming convention for smart pointers across a project.

You can use the macro as follows. Note that the macro argument is the name of the class being defined.

class MyClass
{
public:
LOMIRI_DEFINES_PTRS(MyClass);
// MyClass now provides public typedefs for SPtr, SCPtr, UPtr, and UCPtr.
// ...
};
LOMIRI_DEFINES_PTRS
#define LOMIRI_DEFINES_PTRS(classname)
Macro to add smart pointer definitions to a class.
Definition: DefinesPtrs.h:52

Callers of `MyClass` can now, for example, write

MyClass::UPtr p(new MyClass);