Ignoring “#include”s only in the released library?

I have a templated library where all of my classes are explicitly instantiated and built into a static library. The library is structured like this:

repo/
  | - include/
        | - mylib/
              | - myclass.hpp
        | - implementation/
              | - myclass.ipp
  | - source/
        | - mylib/
              | - myclass.cpp

Inside myclass.hpp will be a template class declaration as well as an inclusion of the definitions, while inside myclass.ipp is the actual definition, as well as explicit instantiation declarations. myclass.cpp contains the actual explicit instantiations. They each look something like the following:

myclass.hpp

template <typename T>
class MyClass { ... };

#include "implementation/myclass.ipp"

myclass.ipp

template <typename T>
void MyClass<T>::MyClass() { ... };
...

extern template class MyClass<MyOtherType1>;
extern template class MyClass<MyOtherType2>;
...

myclass.cpp

template class MyClass<MyOtherType1>;
template class MyClass<MyOtherType2>;

NOTE: Yes, I am aware for what I’ve written here, this is not necessary. My actual library has much more complex templating, constraints, and specializations. This example is just for illustrating the layout of the code. I initially separated the declarations and implementations just to keep the headers readable, but started explicitly instantiated all of my classes because they are only valid for ~6 specific types I know beforehand.

Everything works great, I can build it as a static library and everything works as expected, except for one part. Because each header (.hpp)directly includes its corresponding implementation file (.ipp), all of the third party includes are transitively included for any user of the library. This makes it a pain to use the library when it is installed on a system that may not have a specific library, even when that library is statically linked to my library and should not be an issue.

Normally, this is just something you’d have to deal with when working with template libraries, but because my library is fully explicitly instantiated, I believe that the template definitions are not required anymore. I believe that I could distributed the headers, while somehow ignoring the #include "_.ipp" part.

One thing I think I’d have to change is to move the explicit instantiation declarations into the headers, something like:

template <typename T>
class MyClass { ... };

#include "implementation/myclass.ipp"

extern template class MyClass<MyOtherType1>;
extern template class MyClass<MyOtherType2>;

But I am unsure how to reliably make sure that #include "_.ipp" is included when the library is being developed, but to make sure it is never included when the library is distributed/installed, so that the headers can just be used alone (along with the pre-compiled library).

Is this safe to do with how I have things structured? Again things are slightly more complicated, but I think that the outline I’ve shared here should be fairly representative of the separation I have between the .hpp, .ipp, and .cpp files.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật