Program Listing for File pimpl.hpp
↰ Return to documentation for file (rcppsw/patterns/pimpl/pimpl.hpp
)
#pragma once
/*******************************************************************************
* Includes
******************************************************************************/
#include <memory>
#include <utility>
#include "rcppsw/rcppsw.hpp"
/*******************************************************************************
* Namespaces/Decls
******************************************************************************/
namespace rcppsw::patterns::pimpl {
/*******************************************************************************
* Class Definitions
******************************************************************************/
template<typename TImpl>
struct pimpl {
template<typename ...Args>
explicit pimpl(Args&&... args) :
impl(std::make_unique<TImpl>(std::forward<Args>(args)...)) {}
virtual ~pimpl(void) = default;
std::unique_ptr<TImpl> impl;
};
} /* namespace rcppsw::patterns::pimpl */