Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template< typename T >
- struct with_pimpl {
- protected:
- template< typename ... Args >
- explicit with_pimpl (Args &&... args) : pimpl (new (this->pimpl_mem) T (std::forward< Args > (args)...)) {}
- ~with_pimpl () { this->pimpl->~T (); }
- protected:
- T *pimpl = nullptr;
- private:
- char pimpl_mem [sizeof (T)] = { 0 };
- };
Advertisement
Add Comment
Please, Sign In to add comment