Jump to content
  • Advertisement
Sign in to follow this  
SeaBourne

C++ Template && Pimpl

This topic is 2718 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

In my project application's library, I have classes that use the pimpl idiom for binary compatibility. The problem is that templates require the implementation to be known in the header. How can I be able to keep the details hidden with pimpl while still being able to use templates?

Share this post


Link to post
Share on other sites
Advertisement
If the stuff in the pimpl class depends on the template parameters, then you're somewhat out of luck. The best you can probably do is factor-out as much as possible that isn't dependent on those parameters. I think this is what a lot of the Qt containers do, for example and IIRC TC++PL contains information on the technique in one of the later chapters.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!