Is the pImpl idiom really used in practice?

后端 未结 11 1416
渐次进展
渐次进展 2020-11-22 17:21

I am reading the book \"Exceptional C++\" by Herb Sutter, and in that book I have learned about the pImpl idiom. Basically, the idea is to create a structure for the p

11条回答
  •  一个人的身影
    2020-11-22 17:41

    I think this is one of the most fundamental tools for decoupling.

    I was using pimpl (and many other idioms from Exceptional C++) on embedded project (SetTopBox).

    The particular purpose of this idoim in our project was to hide the types XImpl class uses. Specifically we used it to hide details of implementations for different hardware, where different headers would be pulled in. We had different implementations of XImpl classes for one platform and different for the other. Layout of class X stayed the same regardless of the platfrom.

提交回复
热议问题