Pimpl

 


 

1. 《Effective Mocern C++》的作者在“item 22: Pimpl Idiom”的理解:

      已经整理:  https://blog.****.net/qq_35865125/article/details/103837518

 

2. 《API Design for C++》的作者Martin Reddy在 “3.1 PIMPL IDIOM”的理解:

The term pimpl was first introduced by Jeff Sumner as shorthand for “pointer to implementation”(Sutter, 1999). This technique can be used as a way to avoid exposing private details in your public header files . It is therefore an important mechanism to help you maintain a strong separation between your API’s interface and implementation (Sutter and Alexandrescu, 2004).

While pimpl is not strictly a design pattern (it’s a workaround to C++ specific limitations), it is an idiom that can
be considered a special case of the Bridge design pattern.


2.1 PIMPL IDIOM

----靠的是opaque pointer来隐藏实现细节到cpp文件:
Pimpl