Skip to content

ArgishtiAyvazyan/FastPimpl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FastPimpl

Implementation of Fast Pimpl idiom.

Pimpl is a C++ programming technique that removes implementation details of a class from its object representation by placing them in a separate class, accessed through an opaque pointer. This technique is used to construct C++ library interfaces with stable ABI and to reduce compile-time dependencies.

An implementation using a pointer can be found here.

Access overhead

In pImpl, each call to a private member function indirects through a pointer. Each access to a public member made by a private member indirects through another pointer.

To avoid performance losses, you can use the FastPimpl helper class.

The interfaces of Fast Pimpl and the regular pointer are almost identical, which will help to easily use it.

Building

On linux

  • mkdir build && cd build
  • cmake ..
  • make
  • ./test/main_exec - to run the small demo

On Windows

Project structure

├── CMakeLists.txt
├── include
│   └── FastPimpl.h
└── test
    ├── CMakeLists.txt
    ├── Interface.cpp
    ├── Interface.h
    ├── Main.cpp
    └── NativeType.h

License

This project is licensed under the MIT License - see the LICENSE file for details

About

The implementation of Fast Pimpl idiom.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors