https://github.com/mguludag/cpp-pimpl-helper
A simple helper type alias for std::unique_ptr and custom deleter for using pimpl idiom with std::unique_ptr easily
https://github.com/mguludag/cpp-pimpl-helper
cpp pimpl unique-ptr
Last synced: 10 months ago
JSON representation
A simple helper type alias for std::unique_ptr and custom deleter for using pimpl idiom with std::unique_ptr easily
- Host: GitHub
- URL: https://github.com/mguludag/cpp-pimpl-helper
- Owner: mguludag
- License: mit
- Created: 2021-09-14T19:48:46.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-09-24T00:17:00.000Z (over 4 years ago)
- Last Synced: 2025-06-24T15:05:46.705Z (10 months ago)
- Topics: cpp, pimpl, unique-ptr
- Language: C++
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cpp-pimpl-helper
A simple helper type alias for std::unique_ptr and custom deleter for using pimpl idiom with std::unique_ptr easily on MSVC
## Usage
*impl.hpp*
```C++
#include
class Impl
{
public:
...
private:
class Pimpl_;
stdx::pimpl::unique_ptr pimpl_;
};
```
*impl.cpp*
```C++
#include "impl.hpp"
...
class Pimpl_
{
...
};
Impl::Impl()
{
pimpl_ = stdx::pimpl::make_unique(...);
...
}
...
```