gz/utils/ImplPtr.hh File Reference
#include <memory>
#include <utility>
#include <gz/utils/config.hh>
#include <gz/utils/detail/DefaultOps.hh>
#include <gz/utils/SuppressWarning.hh>
#include <gz/utils/Export.hh>
#include <gz/utils/detail/ImplPtr.hh>
Go to the source code of this file.
Classes | |
class | ImplPtr< T, Deleter, Operations > |
The ImplPtr class provides a convenient away to achieve the Rule of Zero while keeping all the benefits of PIMPL. This saves us from writing an enormous amount of boilerplate code for each class. More... | |
Namespaces | |
ignition | |
ignition::utils | |
Macros | |
#define | IGN_UTILS_IMPL_PTR(memberName) |
Add a private ImplPtr to a class as dataPtr. This variant forward-declares Class::Implementation as the impl. More... | |
#define | IGN_UTILS_IMPL_PTR_FWD(ImplementationClass, memberName) |
Add a private ImplPtr to a class as dataPtr. This variant takes a forward-declared ImplementationClass as the impl. More... | |
#define | IGN_UTILS_UNIQUE_IMPL_PTR(memberName) |
Add a private UniqueImplPtr to a class as dataPtr. This variant forward-declares Class::Implementation as the impl. More... | |
#define | IGN_UTILS_UNIQUE_IMPL_PTR_FWD(ImplementationClass, memberName) |
Add a private UniqueImplPtr to a class as dataPtr. This variant takes a forward-declared ImplementationClass as the impl. More... | |
Typedefs | |
template<class T , class Deleter = void (*)(T*)> | |
using | UniqueImplPtr = std::unique_ptr< T, Deleter > |
This is an alternative to ImplPtr<T> which serves the same purpose, except it only provide move semantics (i.e. it does not allow copying). This should be used in cases where it is not safe (or not possible) to copy the underlying state of an implementation class. More... | |
Functions | |
template<class T , typename... Args> | |
ImplPtr< T > | MakeImpl (Args &&..._args) |
Pass this to the constructor of an ImplPtr object to easily initialize it. All the arguments passed into this function will be perfectly forwarded to the implementation class that gets created. More... | |
template<class T , typename... Args> | |
UniqueImplPtr< T > | MakeUniqueImpl (Args &&..._args) |
Pass this to the constructor of a UniqueImplPtr object to easily initialize it. All the arguments passed into this function will be perfectly forwarded to the implementation class that gets created. More... | |
Macro Definition Documentation
◆ IGN_UTILS_IMPL_PTR
#define IGN_UTILS_IMPL_PTR | ( | memberName | ) |
Value:
public: class Implementation; \
IGN_UTILS_IMPL_PTR_FWD(Implementation, memberName)
Add a private ImplPtr to a class as dataPtr. This variant forward-declares Class::Implementation as the impl.
◆ IGN_UTILS_IMPL_PTR_FWD
#define IGN_UTILS_IMPL_PTR_FWD | ( | ImplementationClass, | |
memberName | |||
) |
Value:
IGN_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING \
private: ::ignition::utils::ImplPtr<ImplementationClass> memberName; \
IGN_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING
Add a private ImplPtr to a class as dataPtr. This variant takes a forward-declared ImplementationClass as the impl.
◆ IGN_UTILS_UNIQUE_IMPL_PTR
#define IGN_UTILS_UNIQUE_IMPL_PTR | ( | memberName | ) |
Value:
public: class Implementation; \
IGN_UTILS_UNIQUE_IMPL_PTR_FWD(Implementation, memberName)
Add a private UniqueImplPtr to a class as dataPtr. This variant forward-declares Class::Implementation as the impl.
◆ IGN_UTILS_UNIQUE_IMPL_PTR_FWD
#define IGN_UTILS_UNIQUE_IMPL_PTR_FWD | ( | ImplementationClass, | |
memberName | |||
) |
Value:
IGN_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING \
private: ::ignition::utils::UniqueImplPtr<ImplementationClass> memberName; \
IGN_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING
Add a private UniqueImplPtr to a class as dataPtr. This variant takes a forward-declared ImplementationClass as the impl.
The ImplPtr class provides a convenient away to achieve the Rule of Zero while keeping all the benefi...
Definition: gz/utils/ImplPtr.hh:75
STL class.