#include <memory>
#include <stdexcept>
#include <utility>
Go to the source code of this file.
◆ ZIVID_PIMPL_MOVE_ONLY
      
        
          | #define ZIVID_PIMPL_MOVE_ONLY | ( |  | ClassName, | 
        
          |  |  |  | Attributes ) | 
      
 
Value:public:                                                                                                                \
    Attributes ~ClassName();                                                                                           \
    Attributes ClassName(const ClassName &other) = delete;                                                             \
    Attributes ClassName &operator=(const ClassName &other) = delete;                                                  \
    Attributes ClassName(ClassName &&other) noexcept;                                                                  \
    Attributes ClassName &operator=(ClassName &&other) noexcept;                                                       \
                                                                                                                       \
    Attributes explicit ClassName(std::unique_ptr<class ClassName##Impl> &&impl);                                      \
    Attributes class ClassName##Impl &getImpl();                                                                       \
    Attributes const class ClassName##Impl &getImpl() const;                                                           \
                                                                                                                       \
private:                                                                                                               \
    std::unique_ptr<class ClassName##Impl> m_impl
 
 
◆ ZIVID_PIMPL_MOVE_ONLY_CPP
      
        
          | #define ZIVID_PIMPL_MOVE_ONLY_CPP | ( |  | ClassName | ) |  | 
      
 
Value:    ClassName::ClassName(std::unique_ptr<ClassName##Impl> &&impl)                                                      \
        : m_impl{ std::move(impl) }                                                                                    \
    {}                                                                                                                 \
                                                                                                                       \
    ClassName##Impl &ClassName::getImpl()                                                                              \
    {                                                                                                                  \
        return const_cast<ClassName##Impl &>(std::as_const(*this).getImpl());                                          \
    }                                                                                                                  \
                                                                                                                       \
    const ClassName##Impl &ClassName::getImpl() const                                                                  \
    {                                                                                                                  \
        if(m_impl == nullptr)                                                                                          \
        {                                                                                                              \
            throw std::runtime_error(#ClassName " is empty");                                                          \
        }                                                                                                              \
        return *m_impl;                                                                                                \
    }                                                                                                                  \
                                                                                                                       \
    ClassName::~ClassName() = default;                                                                                 \
    ClassName::ClassName(ClassName &&other) noexcept = default;                                                        \
    ClassName &ClassName::operator=(ClassName &&other) noexcept = default
 
 
◆ ZIVID_PIMPL_REFERENCE_SEMANTICS
      
        
          | #define ZIVID_PIMPL_REFERENCE_SEMANTICS | ( |  | ClassName, | 
        
          |  |  |  | Attributes ) | 
      
 
Value:public:                                                                                                                \
    Attributes ~ClassName();                                                                                           \
    Attributes ClassName(const ClassName &other);                                                                      \
    Attributes ClassName &operator=(const ClassName &other);                                                           \
    Attributes ClassName(ClassName &&other) noexcept;                                                                  \
    Attributes ClassName &operator=(ClassName &&other) noexcept;                                                       \
    Attributes explicit ClassName(std::shared_ptr<class ClassName##Impl> &&impl);                                      \
    Attributes class ClassName##Impl &getImpl();                                                                       \
    Attributes const class ClassName##Impl &getImpl() const;                                                           \
                                                                                                                       \
private:                                                                                                               \
    std::shared_ptr<class ClassName##Impl> m_impl
 
 
◆ ZIVID_PIMPL_REFERENCE_SEMANTICS_CPP
      
        
          | #define ZIVID_PIMPL_REFERENCE_SEMANTICS_CPP | ( |  | ClassName | ) |  | 
      
 
Value:    ClassName::ClassName(std::shared_ptr<ClassName##Impl> &&impl)                                                      \
        : m_impl{ std::move(impl) }                                                                                    \
    {}                                                                                                                 \
                                                                                                                       \
    ClassName##Impl &ClassName::getImpl()                                                                              \
    {                                                                                                                  \
        return const_cast<ClassName##Impl &>(std::as_const(*this).getImpl());                                          \
    }                                                                                                                  \
                                                                                                                       \
    const ClassName##Impl &ClassName::getImpl() const                                                                  \
    {                                                                                                                  \
        if(m_impl == nullptr)                                                                                          \
        {                                                                                                              \
            throw std::runtime_error(#ClassName " is empty");                                                          \
        }                                                                                                              \
        return *m_impl;                                                                                                \
    }                                                                                                                  \
                                                                                                                       \
    ClassName::~ClassName() = default;                                                                                 \
    ClassName::ClassName(const ClassName &other) = default;                                                            \
    ClassName &ClassName::operator=(const ClassName &other) = default;                                                 \
    ClassName::ClassName(ClassName &&other) noexcept = default;                                                        \
    ClassName &ClassName::operator=(ClassName &&other) noexcept = default
 
 
◆ ZIVID_PIMPL_VALUE_SEMANTICS
      
        
          | #define ZIVID_PIMPL_VALUE_SEMANTICS | ( |  | ClassName, | 
        
          |  |  |  | Attributes ) | 
      
 
Value:public:                                                                                                                \
    Attributes ~ClassName();                                                                                           \
    Attributes ClassName(const ClassName &other);                                                                      \
    Attributes ClassName &operator=(const ClassName &other);                                                           \
    Attributes ClassName(ClassName &&other) noexcept;                                                                  \
    Attributes ClassName &operator=(ClassName &&other) noexcept;                                                       \
                                                                                                                       \
    Attributes explicit ClassName(std::unique_ptr<class ClassName##Impl> &&impl);                                      \
    Attributes explicit ClassName(class ClassName##Impl &&impl);                                                       \
    Attributes class ClassName##Impl &getImpl();                                                                       \
    Attributes const class ClassName##Impl &getImpl() const;                                                           \
                                                                                                                       \
private:                                                                                                               \
    std::unique_ptr<class ClassName##Impl> m_impl
 
 
◆ ZIVID_PIMPL_VALUE_SEMANTICS_CPP
      
        
          | #define ZIVID_PIMPL_VALUE_SEMANTICS_CPP | ( |  | ClassName | ) |  |