In the C++ Boost libraries, why is there a “.ipp” extension on some header files

前端 未结 2 813
别那么骄傲
别那么骄傲 2020-12-13 13:12

In the C++ Boost libraries, why is there a \".ipp\" extension on some header files?

It seems like they are header files included by the \".hpp\" file of the same n

2条回答
  •  死守一世寂寞
    2020-12-13 13:58

    Explanation from one of the template gurus:

    If you want to split up your template sources into interface and implementation (there are lots of good reasons to do that, including controlling instantiation), you can't very well use the same name (foo.hpp) twice, and foo.cpp wouldn't be appropriate for either one. foo.ipp clearly delineates the file as an implementation file intended to be #included in foo.hpp.

提交回复
热议问题